如何在cloudant中为下面的cloudant json数据编写选择器查询

时间:2017-06-21 12:17:56

标签: node.js cloudant cloudant-sdp

如何为cloudant中的(有效负载)专门编写以下数据的选择器查询?

    {
      "_id": "1575370d5a7a4cdcd11c64f9066ed454",
      "_rev": "1-2c8aa9288c2e86aa83cea78299c63dcf",
      "topic": "smart_parking",

如何为cloudant中的(有效负载)专门编写以下数据的选择器查询?

      "payload": [
        {
          "smart_parking": [
            {

如何为下面的JSON响应编写选择器?

              "spots": [
                {
                  "read_time": "Wed Jun 21 11:37:55 2017",
                  "awsDeviceIdentifier": "myiot",
                  "vehicle_Make_Model": "suv-crossover",
                  "model_num_car": "subaru_tribeca",
                  "vehicle_make": "subaru",
                  "color": "blue",
                  "time_stamp": 1498045075.780167,
                  "number_plate": "DZDDYXR",
                  "type": "car",
                  "occupied": true
                }
              ]
            }
          ]
        }
      ]
    }

//这是样本

1 个答案:

答案 0 :(得分:0)

{   “选择者”:{

"payload": {
"$elemMatch":{
  "smart_parking": {
  "$elemMatch":{
    "spots":{
    "$or":[
      {
     "$elemMatch":{"number_plate":"DZDDYXR"} 
     },
     {
     "$elemMatch":{"color":"blue"}
     }
     ]
     }

  }
   }  

  }
}

},   “田野”:[

] }