On adding the ordering property to the model, the compiler throws an error
import { objectType } from '@prisma/nexus'
export const User = objectType({
name: 'User',
definition(t) {
t.model.id()
t.model.name()
t.model.email()
t.model.posts({
ordering: true,
})
},
})
The following error is received in the terminal
Using ts-node version 8.3.0, typescript version 3.5.3
Error: Could not find ordering argument for User.posts
Even the internal ordering fields are also not working
import { objectType } from '@prisma/nexus'
export const User = objectType({
name: 'User',
definition(t) {
t.model.id()
t.model.name()
t.model.email()
t.model.posts({
ordering: { title: true },
})
},
})
prisma2: 2.0.0-preview-7
@prisma/nexus: 0.0.1
nexus: 0.12.0-beta.6
I'm having the same issue.
I started my project using prisma2 init and choosing SQLite, TypeScript, and the GraphQL boilerplate. I simply edited src/resolvers/User.ts by changing one line of code:
...
t.model.posts({ pagination: false });
<CHANGED TO>
t.model.posts({ pagination: false, filtering: true, ordering: true });
...
When I start the server I get the error Error: Could not find filtering argument for User.posts. Both filtering and ordering throw an error even if used independently.
prisma2: 2.0.0-preview-8
@prisma/nexus: 0.0.1
nexus: 0.12.0-beta.6
You might have more luck opening this under this project: https://github.com/prisma/nexus-prisma - I believe the issue is specific to the nexus-prisma plugin.
Can you please update your deps to the latest versions. You can refer to the example in this repo.
You can see a working example of ordering in the example. Just update to latest versions to get things working.
@jasonkuhrt Thanks for the guidance, looks like examples/boilerplate must have been incorrect. I've switched to using nexus rather than @prisma/nexus and followed the example, can confirm filtering/order is working.
Most helpful comment
I'm having the same issue.
Steps
I started my project using
prisma2 initand choosingSQLite,TypeScript, and theGraphQL boilerplate. I simply editedsrc/resolvers/User.tsby changing one line of code:When I start the server I get the error
Error: Could not find filtering argument for User.posts. Bothfilteringandorderingthrow an error even if used independently.Library versions
prisma2:
2.0.0-preview-8@prisma/nexus:
0.0.1nexus:
0.12.0-beta.6