0

I have a collection, users, that contained a field which is array of object: {"status":"active", "children": [{"name": "jack", "id": 1234}]}

I'm trying to search on this collection and find the user that children.id equals to 1234.

I tried with this:

db.collection('users').where('children', 'array_contains', {'id': 1234}).get()

and also this:

db.collection('users').where('children.id', '==', 1234).get() but did not work.

How can I do these kinds of queries on firestore?
Nasrin
  • 157
  • 2
  • 9

1 Answers1

0

Unfortunately you can't query this way and this question was already discussed here. You need to revise your data structures.

Jaroslav
  • 724
  • 4
  • 17