I have in a collection an reference array of ObjectId. And I want to return the object's data linked with those Ids in the json response.
retrieveFromUser: function( req, res ) {
var user_id = req.params.user_id;
User.findById( user_id, function( err, user ) {
if( err ) {
res.send( 404, "Unable to find user");
} else {
// This returns the array but I want the objects data
return res.json( user.constructions );
}
});
}
How can I do that ?
thanks a lot !