-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
36 lines (29 loc) · 897 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { PrismaClient, Prisma } from "@prisma/client"
import { ObjectId } from "mongodb"
const prisma = new PrismaClient()
async function main() {
// const categories = await prisma.category.findMany()
const categories = await prisma.category.findRaw({
filter: {
name: "Fashion",
},
// One of the below should work, probably the _id since this is a raw
// query that maps to the underlying _id:
// filter: {
// _id: { $eq: new ObjectId("61e20bbd7fef3b66f439373b") },
// } as any,
// filter: {
// _id: { $eq: "61e20bbd7fef3b66f439373b" },
// } as any,
// filter: {
// id: { $eq: new ObjectId("61e20bbd7fef3b66f439373b") },
// } as any,
// filter: {
// id: { $eq: "61e20bbd7fef3b66f439373b" },
// } as any,
})
console.log(categories)
}
main()
.catch(console.error)
.finally(() => prisma.$disconnect())