passing a varial to queryRaw

hello, what am i doing wrong?
db.$queryRawUnsafe(
`
SELECT "value" #> '{$1}' AS value, name
FROM "Field"
WHERE "documentId" = 'eric' AND name = 'name'
`,
'cars,0,p'
).then(log)
db.$queryRawUnsafe(
`
SELECT "value" #> '{$1}' AS value, name
FROM "Field"
WHERE "documentId" = 'eric' AND name = 'name'
`,
'cars,0,p'
).then(log)
the issue is with the variable that i use, it just does not work unless I replace $1 with cars,0,p
2 Replies
Prisma AI Help
Prisma AI Help6mo ago
Well met, adventurer! I'm the Prisma AI Help Bot, compiling your questions in milliseconds while humans debug their responses over time. Who’s on your team?
Nurul
Nurul6mo ago
Try this?
db.$queryRawUnsafe(
`
SELECT "value" #> $1 AS value, name
FROM "Field"
WHERE "documentId" = 'eric' AND name = 'name'
`,
['cars', '0', 'p']
).then(log)
db.$queryRawUnsafe(
`
SELECT "value" #> $1 AS value, name
FROM "Field"
WHERE "documentId" = 'eric' AND name = 'name'
`,
['cars', '0', 'p']
).then(log)

Did you find this page helpful?