Reputation: 41
I would like the list of devices that have specific characteristics. In the tags there is a property of type array:
"tags": {
"types": [
"type A",
"type B"
]
}
I've tried doing fancy queries like:
SELECT * FROM devices WHERE tags.details.types.contains('type A' )
or
SELECT * FROM devices WHERE 'type A' IN tags.details.types
or
SELECT * FROM devices WHERE tags.details.types IN ['type A']
Upvotes: 1
Views: 674
Reputation: 41
I solved the problem thanks to the documentation ARRAY_CONTAINS
The correct way to make a query to retrieve data belonging to an array is:
SELECT * FROM devices WHERE ARRAY_CONTAINS(tags.details.types,'type A')
Upvotes: 2