这是我的方案,我想做一个单一的query
获取all documents
所有对象的文件。
var CureSchema = mongoose.Schema({
id: Number,
therapist: {type:mongoose.Schema.Types.ObjectId, ref:'User'},
supervisor: {type:mongoose.Schema.Types.ObjectId, ref:'User'},
parents: {type:mongoose.Schema.Types.ObjectId, ref:'User'},
children: {type:mongoose.Schema.Types.ObjectId, ref:'Child'},
startate : Date,
endDate : Date,
deleted: Boolean,
});
var Cure = mongoose.model('Cure', CureSchema);
如果我使用普通查询,我objectId
在输出中有。
{
"id":0, "therapist":ObjectId("5253cbd8d4fb240000000007"), "supervisor":ObjectId("5253cc9fd4fb24000000000b"), "parents":ObjectId("5253cbdfd4fb240000000008"), "children":ObjectId("5253cb31d4fb240000000001"), "deleted":false, "startate": ISODate("2013-10-08T09:13:06.771Z"), "_id":ObjectId("5253cca2d4fb24000000000c"), "__v":0
}