猫鼬"。选择"选择奇怪的行为

时间:2016-07-06 09:44:55

标签: select mongoose

这是我的模特:



var Account = new Schema({
        username: String,
	likes: {
		users: {type: Schema.Types.Mixed, default: {}},
		reviews: {type: Schema.Types.Mixed, default: {}}
	},
	requests: {
		incoming: {type: Schema.Types.Mixed, default: {}},
		outgoing: {type: Schema.Types.Mixed, default: {}}
	}
}, {minimize: false});




这是我的要求:



router.get('/requests', function(req, res, next) {
	var id = req.user._id;
	var callback = function(err, doc){
		if(err) {
		  next(err);
		  return;			
		}
		res.send(doc);
	}
	Account.findById(id)
		.select({requests: 1})
		.exec(callback)
})




这是我的结果:



{
  likes:{},
  requests: {
    incoming:['a','b','c'],
    outgoing:['d','f','g']
  }
  _id: 'KAJDiasjdaiodjwoi43j034345'
}




为什么"喜欢:{}"出现?

0 个答案:

没有答案