问题
I have a data set like follows-
[{
"allowedusers": ["paul@abc.com"],
"id": "1"
},{
"allowedusers": ["kmahera@abc.com","rbajaniya@abc.com"],
"id": "2"
},{
"allowedusers": ["whatever@abc.com","rbajaniya@abc.com"],
"id": "3"
}]
and I have a Query like this -
http://localhost:3030/flowz$limit=5&allowedusers[$in[]=rbajaniya@abc.com&$skip=0&$select[]=id&$select[]=alloweduser
.
But I am not getting all the objects that contain rbajaniya@abc.com
. How can I craft my query to get this. I want to get id=2 and id=3 in response .
回答1:
$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]=rbajaniya@abc.com&$skip=0&$select[]=id&$select[]=alloweduser
来源:https://stackoverflow.com/questions/48782202/find-nested-array-object-from-rethinkdb-in-feathers-js