Is there any reference docs on the (node) prisma c...
# prisma-client
a
Is there any reference docs on the (node) prisma client? It took me about 40 mins just now to work out the difference between
await prisma.createUser(mutation)
and
prisma.createUser(mutation).id()
-- or what that was doing, and why the examples (in the codesandbox) all return plain objects
n
a
No - it doesn't mention anything about the "colum methods" (for lack of a better name) available on the promise
It just talks about "In this case, the returned user object will have four properties (that correspond to the scalar fields of the User model): id, name, email and password"
n
i thought those methods only existed for relation fields
n
There are some docs for the Prisma Client API here: https://www.prisma.io/docs/prisma-client/basic-data-access/reading-data-JAVASCRIPT-rsc2/ Please let me know if that helps!
n
can't see nothing about chain methods for scalar fields
trying to do
Copy code
await ctx.prisma.createUser(data).username()
get an error
Copy code
Error: Field 'username' of type 'String' must not have a sub selection. (line 3, column 5):
    username {
    ^
    at BatchedGraphQLClient.<anonymous> (/usr/src/app/node_modules/http-link-dataloader/src/BatchedGraphQLClient.ts:74:13)
    at step (/usr/src/app/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:40:23)
    at Object.next (/usr/src/app/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:21:53)
    at fulfilled (/usr/src/app/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:12:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
could this be an issue with prisma-client?
a
@nikolasburk Same comment - those don't mention anything about the column accessors on the promise that I could see
Copy code
const newUser =  prisma.createUser({
    name: 'Alice',
    email: '<mailto:alice@prisma.io|alice@prisma.io>',
  })
  console.log(`Id `, await newUser.id())