I am trying to retrieve values from "UserKid" collection where "fname" and "Parent_id" are used as conditions. It returns "contentLinkIds" in "det1". I've checked by printing it on the console that it is returning the required content. However, I am not able to access the key-value pairs within the returned object.
UserKid.find({Parent_id:ObjectId(det._id).toString(),fname:fname},'contentLinkIDs', function(err1, det1){
console.log("Det1:" + det1);
console.log("DET1 id:"+ det1._id);
console.log("contentLinkIDs: "+det1.contentLinkIDs);
/*some code here*/
});
Output on console:
Det1:{ _id: 58e08c96f36d2878e036cf21,
contentLinkIDs: [ '58e2dea6f36d283c9c86dd14' ] }
DET1 id:undefined
contentLinkIDs: undefined
Whats going wrong here?
Additonal info: I am using mongoose in Node.js/Express to connect to mlab.
via nashi10
No comments:
Post a Comment