在羽毛JS中从rethinkdb查找嵌套的数组对象 [英] Find nested array-object from rethinkdb in feathers JS

查看:58
本文介绍了在羽毛JS中从rethinkdb查找嵌套的数组对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下数据集

[{

    "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 [] =允许的用户.

但是我没有得到所有包含 rbajaniya@abc.com 的对象.我如何制作查询以获取此信息.我想获得id = 2和id = 3作为响应.

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 .

推荐答案

$ in 用于对照可能值的列表检查数据库中的单个值.您正在寻找的另一种方法是通过 feathers-rethinkdb 特定的 $ contains运算符:

$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

这篇关于在羽毛JS中从rethinkdb查找嵌套的数组对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆