I have a very specific question. I have a web project that is using Express (Node.JS) and MLab (MongoDB/Mongoose). I've manually edited several records in a collection (yeah, I know, bad idea) and am using one of those fields in a Mongoose search. The schema is defined as follows: (relevant part only)
我有一个非常具体的问题。我有一个使用Express(Node.JS)和MLab(MongoDB / Mongoose)的Web项目。我已经手动编辑了一个集合中的几个记录(是的,我知道,坏主意)并且正在使用Mongoose搜索中的其中一个字段。模式定义如下:(仅限相关部分)
user: {
id: {
type: mongoose.Schema.Types.ObjectId,
ref: "Registration"
},
username: String,
type: String
}
My search is as follows:
我的搜索如下:
Master.find({$or: [{'user.type': 'committee'}, {'user.type': 'admin'}]}, function(err, foundUsers) {
do stuff
});
The search works just fine (using 'user.type'), but the user object in each record is undefined in foundUsers.
搜索工作正常(使用'user.type'),但是在FoundUsers中未定义每个记录中的用户对象。
What am I missing? Thanks!
我错过了什么?谢谢!
1 个解决方案
#1
0
Found it. I tried to pull a fast one and add something to the user record that wasn't in the Registration Schema. Mongo was smarter than I was in this case.
找到了。我尝试拉一个快速的,并添加一些不在注册模式中的用户记录。在这种情况下,Mongo比我更聪明。
#1
0
Found it. I tried to pull a fast one and add something to the user record that wasn't in the Registration Schema. Mongo was smarter than I was in this case.
找到了。我尝试拉一个快速的,并添加一些不在注册模式中的用户记录。在这种情况下,Mongo比我更聪明。