Search objects where id == for object in list field of a document

Hello guys,

I have been looking at this for few hours, no results what so ever.
Let’s say I have documents (around 20000 or so) with the following structure

"id": 1,
"name": "channel",
"participants": [
{"profile": {"id": 1, "name": "John"}, "status": {"id": 1, "name": "active"}},
{"profile": {"id": 2, "name": "Kate"}, "status": {"id": 2, "name": "inactive"}},
{"profile": {"id": 3, "name": "Alex"}, "status": {"id": 1, "name": "active"}},
{"profile": {"id": 4, "name": "Glea"}, "status": {"id": 1, "name": "active"}},

I want to fetch only those documents where one of the participants = 1 or 2 or something that I pass

How can I do so?

This is in principal a simple query. So please share what you tried as you might only have a simple detail wrong that we can spot.

Also, taking into account that the top document you posted include 2 matching participants, do you want the array elements of and in the result document or do you want to filtered out.

1 Like

I used eventually match to do this and all worked.
Not sure if search works here though

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.