findDoc for overlap string array field
Is there a way in massive-js to findDoc for overlap string array field
db.products.saveDoc({
type: 'widget'
colors: ['gray', 'purple', 'red']
})
The below query doesnot give the result
db.products.findDoc({
colors: ['gray', 'purple']
})
The below query gave an error 'operator does not exist: text && unknown' > Due to overlap not support by jsonb https://www.postgresql.org/docs/9.5/functions-json.html
db.products.findDoc({
'colors &&': ['purple', 'red']
})
db.products.findDoc({
or: [{'colors @>': ['purple']}, {'colors @>': ['red']}]
})
will translate to SELECT * FROM "products" WHERE ((("body"->>'colors') @> $1) OR (("body"->>'colors') @> $2))
instead of SELECT * FROM "products" WHERE ((("body"->'colors') @> $1) OR (("body"->'colors') @> $2))
Edited by zhangpengchen