P
Prisma•5mo ago
dev

Hi everyone. I have a question regarding NestJS and Prisma ORM.

Hi everyone. I have a question regarding NestJS and Prisma ORM. I'm working with a table that includes fields like createdAt, updatedAt, etc. When querying with Prisma, I'd like to alias these field names to created_at, updated_at, and so on. Does Prisma have any operators or functionality that support aliasing field names? Thanks in advance for your help!
1 Reply
RaphaelEtim
RaphaelEtim•5mo ago
Hi @dev 👋 Prisma Client does not support aliasing field names directly in queries. There is a feature request for it here. As a workaround, you will need to map through the result and rename as shown here
GitHub
Issues · prisma/prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - Issues · prisma/prisma
GitHub
Change response field names · Issue #4433 · prisma/prisma
Problem I'm trying to rename some fields when using select. Suggested solution This is my current query: const data = await prisma.data_riskscores.findMany({ select: { id: true, sections: true,...
Want results from more Discord servers?
Add your server