2016-07-04 94 views
1
I want to get result where secondaryParents = 1000004. How we can achive this. 

{ 
    "_id" : ObjectId("577a151859defb33c0f8bf4a"), 
    "_class" : "com.nv.tracker.db.model.User", 
    "parentId" : NumberLong(1000004), 
    "userId" : NumberLong(1000005), 
    "firstName" : "Pranav", 
    "lastName" : "Rathore", 
    "addr" : { 
     "address" : "", 
     "landmark" : "", 
     "city" : "", 
     "state" : "", 
     "country" : "" 
    }, 
    "email" : "[email protected]", 
    "mobile" : "7879066069", 
    "createdDate" : ISODate("2016-07-04T07:49:44.000Z"), 
    "activeStatus" : false, 
    "imagePath" : "http://172.20.0.210:8080/nvtracker/rest/resource/image/1000005", 
    "deviceId" : "78 79 066069", 
    "isSuperUser" : false, 
    "dob" : "1468348200000", 
    "checkAndriodOrIos" : 0, 
    "isLogin" : false, 
    "otp" : 0, 
    "batteryLevel" : 30, 
    "locationInterval" : 60, 
    "deviceSpeed" : 45, 
    "primaryMobile" : "9039101994", 
    "secondaryMobile1" : "9039101994", 
    "secondaryMobile2" : "", 
    "primaryEmail" : "[email protected]", 
    "secondaryEmail1" : "[email protected]", 
    "secondaryEmail2" : "", 
    "isVerified" : false, 
    "currentBatteryLevel" : 0, 
    "currentSpeed" : 0, 
    "subscriptionExpDate" : NumberLong(1498132426000), 
    "enableNotification" : 1, 
    "enableTakeOffAlert" : 0, 
    "deleted" : false, 
    "hasExternalDevice" : false, 
    "secondaryParents" : { 
     "1000003" : { 
      "secondaryparentId" : NumberLong(1000003), 
      "varifiedDate" : NumberLong(0), 
      "addedDate" : NumberLong(1467628679286), 
      "secreteCode" : "18716" 
     }, 
     "1000004" : { 
      "secondaryparentId" : NumberLong(1000004), 
      "varifiedDate" : NumberLong(0), 
      "addedDate" : NumberLong(1467628679286), 
      "secreteCode" : "18716" 
     } 
    } 
} 

I want to get result where secondaryParents = 1000004. 

我們如何才能實現這一目標,我想要得到的結果,其中secondaryParents = 1000004.我們如何才能實現這一目標, 我想要得到的結果,其中secondaryParents = 1000004. 我們怎樣才能achive這個。如何從MongoDB中獲取對象

I want to get result where secondaryParents = 1000004. 

我們如何才能實現這一目標,我想要得到的結果,其中secondaryParents = 1000004.我們如何才能實現這一目標, 我想要得到的結果,其中secondaryParents = 1000004. 我們怎樣才能實現這一目標。

回答

0
db.parents.find({"secondaryParents.1000004" : {$exists : true}}) 
+0

謝謝,如何得到結果where varifiedDate!= 0 – user3775713