Couchdb 如何在[“V1”、“V3”、“V5”查询中进行多次查询

Couchdb 如何在[“V1”、“V3”、“V5”查询中进行多次查询,couchdb,cloudant,Couchdb,Cloudant,对于具有以下结构的文档 { "countryCode": "US", "status" : "Pending" } 其中countryCode的选项列表有限(ISO国家代码) 而且状态也有一组有限的选项,我只需要选择 用于给定的国家列表和给定的状态列表 在SQL中,它的意思是 countryCode在[“美国”、“AR”、“英国”]和状态在[“待定”、“错误”、“加载”] 在Cloudant/CouchDB

对于具有以下结构的文档

{
  "countryCode": "US",
  "status" : "Pending"
}
其中
countryCode
的选项列表有限(ISO国家代码) 而且
状态
也有一组有限的选项,我只需要选择 用于给定的国家列表和给定的状态列表

在SQL中,它的意思是

countryCode在[“美国”、“AR”、“英国”]
状态在[“待定”、“错误”、“加载”]

在Cloudant/CouchDB中可能吗?

使用CouchDB,以下内容会产生所需的结果:

{
   "selector":{
      "$and":[
         {
            "countryCode":{
               "$in":["US", "AR", "UK"]
            }
         },
         {
            "status":{
               "$in":["Pending", "Error", "Loading"]
            }
         }
      ]
   }
}
例如中的$特定于某个字段,用于计算存储在该字段中的值

卷曲

curl -H 'Content-Type: application/json' -X POST http://localhost:5984/<db>/_find -d '{"selector":{"$and":[{"countryCode":{"$in":["US", "AR", "UK"]}},{"status":{"$in":["Pending", "Error", "Loading"]}}]}}'
curl-H'内容类型:application/json'-X POSThttp://localhost:5984//_find -d{“选择器”:{“$and”:[{“国家代码”:{“$in”:[“美国”、“AR”、“英国”]},{“状态”:{“$in”:[“待定”、“错误”、“加载”]}}
使用CouchDB,以下操作将产生所需的结果:

{
   "selector":{
      "$and":[
         {
            "countryCode":{
               "$in":["US", "AR", "UK"]
            }
         },
         {
            "status":{
               "$in":["Pending", "Error", "Loading"]
            }
         }
      ]
   }
}
例如中的$特定于某个字段,用于计算存储在该字段中的值

卷曲

curl -H 'Content-Type: application/json' -X POST http://localhost:5984/<db>/_find -d '{"selector":{"$and":[{"countryCode":{"$in":["US", "AR", "UK"]}},{"status":{"$in":["Pending", "Error", "Loading"]}}]}}'
curl-H'内容类型:application/json'-X POSThttp://localhost:5984//_find -d{“选择器”:{“$and”:[{“国家代码”:{“$in”:[“美国”、“AR”、“英国”]},{“状态”:{“$in”:[“待定”、“错误”、“加载”]}}