我希望获得varifiedDate
secondaryParents
内的0
不是{
"_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" : "ashish.dubey@newvisionsoftware.in",
"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" : "ashish.dubey@newvisionsoftware.in",
"secondaryEmail1" : "abb@hh.con",
"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(14676286792586),
"addedDate" : NumberLong(1467628679286),
"secreteCode" : "18716"
},
"1000004" : {
"secondaryparentId" : NumberLong(1000004),
"varifiedDate" : NumberLong(0),
"addedDate" : NumberLong(1467628679286),
"secreteCode" : "18716"
}
}
}
的结果。我怎样才能做到这一点?
数据库结构:
varifiedDate
我希望secondaryParents
0
内的#include <iostream>
#include <string>
using namespace std;
struct FFJSON{
template <typename T>
FFJSON& operator=(T const& t){
cout << "Assigning the object" << endl;
ts=(void*)&t;
return *this;
};
FFJSON& operator=(const char* s){return *this;};
FFJSON& operator=(const string& s){return *this;};
FFJSON& operator=(const int& i){return *this;};
FFJSON& operator=(const unsigned int& i){return *this;};
template <typename T>
operator T(){
cout << "Returning the object." << endl;
return *ts;
}
void* ts;
};
int main(int argh, char** argv) {
FFJSON f;
timespec tt = {3,2};
f = tt;
timespec& t=(timespec&)f;
cout << "sec:"<<t.tv_sec<<endl;
cout << "usec:"<<t.tv_nsec<<endl;
return 0;
}
不是Assigning the object
sec:126885484802960
nsec:4197094
的用户。
请建议我如何实现这一目标。还提供了使用java&#39; mongodb的最佳教程。使用标准API。