Jaye
11/10/2021, 2:16 PMawait prisma.thing.findMany({
take: perPage,
orderBy: {
createdAt: "desc",
},
skip: cursor ? 1 : undefined,
cursor: {
createdAt: cursor,
},
}),
...but prisma doesn't like this because createdAt isn't a unique field
alternatively, i could use id as the cursor like in the example, but i am using `cuid`s:
model Thing {
id String @id @default(cuid())
// other stuff...
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
what's the best approach?Ryan
11/11/2021, 6:15 AMcuid follows a specific order so it should work fine 🙂