JSON Filtering on object key value inside array example from doc doesn't work
model Test {
id String @id @default(uuid()) @db.Uuid
data Json
}
await db.Test.create({data: {data: [{petName:"Claudine"}, {petName: "Sunny"}]}}){ id: 'eb4fd0ac-2039-4e25-99bf-754573af3622', data: [ { petName: 'Claudine' }, { petName: 'Sunny' } ] }
await db.Test.create({data: {data: [{petName:"Nanna"}]}}){ id: '5810d1c1-7ca9-4489-840a-dc3eae5db572', data: [ { petName: 'Nanna' } ] }
await db.Test.findMany({where: {data: {path: ["$[*].petName"], equals: "Claudine"}}})[]
await db.Test.findMany({where: {data: {path: ["$[*].petName"], array_contains: "Claudine"}}})How to make it work? clientVersion: '5.20.0'
0 Replies