1ListModel.findOne({
2 "_id" : "57e6bcab6b383120f0395aed", 'recipients.status' : 1
3 },
4 {
5 _id:1, name: 1, subject:1,'recipients.$': 1
6 },
7 function(err,list) {...}
8);
9
1var fields = { 'properties.OBJECTID': 1, 'properties.TIMESTAMP': 1 };
2var query = Feature.find({id: 1}).select(fields);
1var subSchema = mongoose.Schema({
2 //your subschema content
3},{ _id : false });
1 System.findOne({ 'nodes.main.Alpha': 23000}, function(err, system){
2 if(err){console.log(err);}
3 else{console.log(system);}
4 });
1exports.feed = function (req, res) {
2 var userIds = req.user.friends;
3
4 Surf
5 .find({user_id: {$in: userIds}})
6 .populate('user_id', 'name boards') // added boards
7 .populate('friends', 'name')
8 // .populate('board_id', 'name size') // can't do this as discussed
9 .exec(function (err, surfs) {
10 if (err) {
11 return handleError(res, err);
12 }
13
14 surfs.forEach(function (surf) {
15 surf.boardInfo = surf.user_id.boards.id(surf.board_id)
16 });
17 // TODO: now remove the surf.user_id.boards.
18 return res.json(200, surfs);
19 });
20
21};