Turns out the casting of the ObjectId seemed to be the issue. It was being cast using the Schema type Object Id mongoose.Schema.Types.ObjectId when it needed to be just a pure ObjectId mongoose.Types.ObjectId.
意思大致是ObjectId 需要使用
mongoose.Types.ObjectId.不能使用mongoose.Schema.Types.ObjectId如上代码中的ObjectId 属于 mongoose.Schema.Types.ObjectId, 想当然的使用直接用 ObjectId(_id) 还是空的结果
因此正确写法:
mongoose.Types.ObjectId(_id);
注释:这里的mongoose 是
var mongoose = require('mongoose');