CouchDB 查询列表没有给出任何结果

CouchDB query list not giving any result

我正在尝试在 couchDB 中查询以使用代码进行过滤 ='hi'

{
id:1,
linked": {
  "type": "XX",
  "code": [
   "hi",
   "hello"
  ]
 }

这就是我正在尝试的方式:

{
   "selector": {
      "linked": {
         "type": "xx",
         "$elemMatch": {
            "code": "hi"
         }
      }
   }
}

我没有得到output.Can任何人的帮助

如果我正确理解了您查询的意图,我认为您的意思是:

{
   "selector": {
      "linked.type": "XX",
      "linked.code": {
         "$elemMatch": {
            "$eq": "hi"
         }
      }
   }
}
  • 要访问文档的子对象,请使用 "dot notation",例如linked.type
  • 相等运算符区分大小写。 "XX" 不是 "xx"
  • $elemMatch 运算符指定不正确。参见 the docs here