node.js - Populate issue with mongodb? -
i trying populate stories stored in stories array reference story id not stories when know there... , reason stories of user in db make sense...
here how reference in mongoose schema:
stories: [{ type: schema.types.objectid, ref: 'story' }],
this populate query not return correct results:
user.find({_id: query}).populate({ path: "stories", select: "_id name location date_updated date_created picture", options: {limit: limit, skip: skipcount } }).exec(function(err, users) { if(err) console.log(err); console.log(users); res.json(users); });
query userid being passed , limit , skipcount being set accordingly (skip 0, limit 100. trying stories in user's stories array...
Comments
Post a Comment