我想引用在節點模型另一個對象,MongoDB的類型參考節點
User = new Schema({
username: {
type: String,
index: {unique: true}
}
});
Idea = new Schema({
Creator: {
type: User
}
});
,但我得到這個錯誤Undefined type at "creator" Did you try nesting Schemas? You can only nest using refs or arrays.
我相信我要用裁判,但它無法找到文檔,可一些一個幫助我。謝謝
1.救命2.「mongoose.Types.ObjectId」和「mongoose.Schema.ObjectId」有什麼區別?我發現它真的很混亂,它觸發「未定義類型」的錯誤,它很難理解爲什麼 – 2013-12-05 14:22:17
我想知道 的差異mongoose.Types.ObjectId VS mongoose.Schema.ObjectId太! – sunnycmf 2014-02-16 14:47:01