Feathers.js 猫鼬查询

Feathers.js mongoose querying

我是 feathers.js 的新手,您将如何完成对对象的查询?

{
   ...,
   obj: {
      foo: 1,
      bar: 1
   },
   ...
}

下面好像不行

/some-doc?obj['foo']['$eq']=1

此外,您将如何处理诸如检查数组大小之类的查询

/some-doc?someArray['length']['$gt']=0

我一直在尝试发送像

这样的参数
checkArray=true

在 before:find 处理它,但运气不好。这是正确的方法吗?

谢谢,

一般来说,Mongoose 和 MongoDB 支持的大多数查询都适用于您的 Feathers 服务。 MongoDB 查询嵌套字段 using the dot notation 所以它将是:

/some-doc?obj.foo=1

可以使用 $size operator. To check if an array has a certain length, you can use the dot notation to see if the entry at the index exists (see this answer):

进行长度查询
/some-doc?someArray.1[$exists]=true