Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在couchdb中使用JSON路径查找文档? 请考虑我在沙发DB中有以下文件: { "id": "1234", "user": "test", "info": { "city": "New York" } } { "id": "4567", "user": "test2", "address": { "city": "New York" } }_Couchdb_Couchdb 2.0_Couchdb Python_Couchdb 3.x - Fatal编程技术网

如何在couchdb中使用JSON路径查找文档? 请考虑我在沙发DB中有以下文件: { "id": "1234", "user": "test", "info": { "city": "New York" } } { "id": "4567", "user": "test2", "address": { "city": "New York" } }

如何在couchdb中使用JSON路径查找文档? 请考虑我在沙发DB中有以下文件: { "id": "1234", "user": "test", "info": { "city": "New York" } } { "id": "4567", "user": "test2", "address": { "city": "New York" } },couchdb,couchdb-2.0,couchdb-python,couchdb-3.x,Couchdb,Couchdb 2.0,Couchdb Python,Couchdb 3.x,现在假设我必须查找城市为纽约的文档。 我知道我可以使用_find方法来完成这项工作,如下所示- 发布:http://username:password@127.0.0.1:5984/db\u name/\u find { "selector": { "address": { "city": { "$eq": "New York" } }

现在假设我必须查找城市为纽约的文档。 我知道我可以使用_find方法来完成这项工作,如下所示-

发布:http://username:password@127.0.0.1:5984/db\u name/\u find

{
  "selector": {
    "address": {
      "city": {
        "$eq": "New York"
      }
    }
  }
}
{
  "selector": {
    "*": {
      "city": {
        "$eq": "New York"
      }
    }
  }
}
这将给我以下结果-

{
   "id": "4567",
   "user": "test2",
   "address": {
      "city": "New York"
   }
}

现在我只知道代码> {“城市”:“纽约”} /代码>。但是我想使用一个_find方法调用来获取这两个文档,不管文档是否包含

{“address”:{“city”:“newyork”}
{“info”:{“city”:“newyork”}

我已经试过了,但这不起作用-

发布:http://username:password@127.0.0.1:5984/db\u name/\u find

{
  "selector": {
    "address": {
      "city": {
        "$eq": "New York"
      }
    }
  }
}
{
  "selector": {
    "*": {
      "city": {
        "$eq": "New York"
      }
    }
  }
}
如何使用一个\u find方法调用或类似的方法来获取这两个文档