Lennard
07/03/2022, 11:15 AMAnnu Singh
07/03/2022, 12:43 PMKJReactor
07/03/2022, 7:20 PM@unique
or @@unique
directives do not work with MongoDB. I thought of using JSON schema for validation / prevent duplications but that is not supported as far as I am aware unless using Realm. Has anyone figured out a workaround ?Jean Moirano
07/04/2022, 7:43 AMGezim
07/04/2022, 10:16 AMAdam Boulila
07/04/2022, 11:33 AMthis.prismaService.brand.findMany({
where: {
providerSKU: Providers.ccado,
},
cursor: {
id: body.cursor,
},
take: body.take ? body.take : DEFAULT_TAKE,
include: {
pdf: true,
variants: true,
},
orderBy: {
id: 'asc',
},
})
``````
with the following code snippet, if i supply a cursor.id
that is not available (example: cursor.id: 5
and 5 do not exist) in the database prisma returns nothing, even though there are elements before and after the unavailableId, is this by design or a bug, I would assume the default behavior is to start from the next available IDKJReactor
07/04/2022, 2:52 PMIan Unsworth
07/04/2022, 4:16 PMDevan Patel
07/04/2022, 8:29 PMDevan Patel
07/04/2022, 8:29 PMDevan Patel
07/04/2022, 8:29 PMGezim
07/05/2022, 6:27 AMPrimsa.$queryRaw
allow me to compose a query string based on a few criteria? With TypeORM, I’m using a query builder and adding leftJoinAndSelect
where
groupBy
all conditionally. How would I do that in Prisma?Annu Singh
07/05/2022, 7:17 AMuser
07/05/2022, 8:42 AMMichael Roberts
07/05/2022, 10:42 AMfinaMany
lookup - is there a way to NOT paginate results, I’m filtering off of a start and end period, so I don’t envisage the return to be too large, but I’d like to not paginate, and return all as the default? Could anyone advise please 🙏AnimeshRy
07/05/2022, 11:14 AMpmaneesh03
07/05/2022, 11:55 AMHarsh Singh
07/05/2022, 4:12 PMJoe
07/05/2022, 7:13 PMJeremy Cohen Hoffing
07/05/2022, 7:45 PMnew PrismaClient()
to point to the db URL you want to run them on? It seems crazy to not have this when most other ORMs have this capability, at the very least it would be nice to have some documentation and examples for any potential solutions or workarounds instead of pointing users to old articles or other third-party solutions.Arthur Kam
07/05/2022, 10:02 PMhumblecoder
07/06/2022, 1:45 AMPrisma 4.0.0
but for some reason where: { my_json_field: Prisma.DbNull } ,
still throws JsonNullableFilter
TS error. Any ideas on what I could be missing?Priyanshi Gupta (YB)
07/06/2022, 5:58 AMLiz Mowforth
07/06/2022, 6:37 AMLouis Joubert
07/06/2022, 7:51 AMimport { PrismaClient } from "@prisma/client";
console.log(process.env.TEST);
will pull TEST
from my .env
file?
Earlier the docs say When you use Prisma CLI or Prisma Client, the .env file content and the variables defined in there are put into the system's environment, where Prisma can read it and use it.
When it says using Prisma Client, does that mean using PrismaClient in your code, as opposed to using some CLI command?
I would prefer that it doesn't pull in stuff automatically, but I guess that just means I should not have any stray .env files lying around.user
07/06/2022, 8:00 AMHalvor
07/06/2022, 8:02 AMAydrian Howard
07/06/2022, 1:25 PMimport type { CartItem } from "@prisma/client";
, that type doesn't include the product fields. Here is my query:
const items = await db.cartItem.findMany({
select: { id: true, product: { select: { name: true, price: true } } },
where: { userId }
});
ThanksAydrian Howard
07/06/2022, 2:23 PMnew Int.NumberFormat(...).format()
and it takes a number. It looks like I should be able to do .toNumber()
on the Decimal type to get it as a number, but I get an error that it's not a function. If I do .toString()
that works but TypeScript is unhappy. Here is my code:
{new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD"
}).format(product.price.toString())}
Has anyone ran into something like this using the Decimal type?