Nabarag Paul
Nabarag Paul

Reputation: 319

Find nested array-object from rethinkdb in feathers JS

I have a data set like follows-

[{

    "allowedusers": ["[email protected]"],
    "id": "1"

  },{

    "allowedusers": ["[email protected]","[email protected]"],
    "id": "2"
   },{

    "allowedusers": ["[email protected]","[email protected]"],
   "id": "3"
}]

and I have a Query like this -

http://localhost:3030/flowz$limit=5&allowedusers[$in[][email protected]&$skip=0&$select[]=id&$select[]=alloweduser.

But I am not getting all the objects that contain [email protected] . How can I craft my query to get this. I want to get id=2 and id=3 in response .

Upvotes: 1

Views: 1008

Answers (1)

Daff
Daff

Reputation: 44215

$in is to check a single value in the database against a list of possible values. What you are looking for is the other way around which can be done through the feathers-rethinkdb specific $contains operator:

http://localhost:3030/flowz?$limit=5&allowedusers[$contains][email protected]&$skip=0&$select[]=id&$select[]=alloweduser

Upvotes: 2

Related Questions