I am trying to filter a rethinkdb table (conversations) which contains nested object array called participants. The structure is below.
I am trying to execute a query that selects conversations based on the IDs of the participants.
in plain terms I want to return all conversations where user 'A' with user_id equals 1 and user 'B' with user_id equals 2 are participants.
RETHINKDB DOCUMENT:Conversations
[{
id:'xxx',
createdAt:'xxxxxx',
participants:[
{
user_id:1,
email:'xxxx',
name:'xxxxxx'
},
{
user_id:2,
email:'xxxx',
name:'xxxxxx'
}
]
}
]
I did find this to work, from the documentation