> db.users.findOne();
{
\"_id\" : ObjectId(\"4db8ebb4c693ec0363000001\"),
\"fb\" : {
\"name\" : {
\"last\" : \"Sss\",
\"fi
Try this :
User.findOne( { $where : "this.fb.gender == 'male' " } )
or
User.findOne( { fb.gender : "male" } )
I'm one of the authors of mongoose. You can do this query in one of several ways:
find
syntax
User.findOne({'fb.gender': 'male'}, callback);
where
syntax
User.where('fb.gender', 'male').findOne(callback);
named scope syntax
UserSchema.namedscope('male').where('fb.gender', 'male');
// ...
var User = mongoose.model('User', UserSchema);
// Now you can write queries even more succinctly and idiomatically
User.male.findOne(callback);