Last active
July 6, 2018 12:17
-
-
Save windwp/7387368631f5905288e27550442b929b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// truy van 1 truong nao` do' boi? deepPopulate | |
.deepPopulate('user.business',{populate:{'user' :{select:'displayName profileImageURL business'},'user.business': { select: 'url'}}}) | |
//truy van 1 thanh phan nao` do' trong 1 mang | |
if( req.query.suburb){ | |
searchQuery.suburbs = {$elemMatch: {name: req.query.suburb, enabled: true}}; | |
} | |
//loai. bo? 1 phan tu? khoi? ketu qua try van | |
User.findOne({personcode: code}) | |
.select('-_id -__v') | |
.populate('bookids', '-_id -__v') | |
.exec(function (err, data) { | |
//foo | |
}); | |
//find by name | |
search: { | |
name: { '$regex': value, '$options': 'i' } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment