jasci
06/09/2021, 6:54 PMcontext.prisma.someModel.findUnique({ where: { id: someId } }).someField()
2.
(await context.prisma.someModel.findUnique({ where: { id: someId } })).someField
When I use await it seems like I don’t get access to the relation fields. In the second example if the field is virtual(some relation) it won’t be available, why is that ?
But if I use the example #1 I am able to somehow call the field and resolve its value. How does it work ?
How to properly retrieve fields of a particular model ?
Maybe some links to the doc?
Thank you.Samrith Shankar
06/09/2021, 7:21 PMjasci
06/09/2021, 7:37 PMposts() and profile().
But for some fields there is an error like ctx.prisma.salesDomain.findUnique(...).shippingMethodOrder is not a function but shippingMethodOrder exists on the model.
I guess regular field are resolved just as properties, but relations in some other way.
And I wanted to read more about fields’ resolution: regular and relations.Samrith Shankar
06/10/2021, 5:18 AMincludeSamrith Shankar
06/10/2021, 5:19 AMRyan
06/10/2021, 6:28 AMPrismaPromise and that makes this possible.jasci
06/10/2021, 7:08 AM