0
我使用MongoDB的我的申請,我面臨着像一個領域的問題接受重複的值,以及我不想限制重複的值存儲在MongoDB中
我想知道如何限制它
我已經通過指定unique :true
一個字段quesListName
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var QuestionListSchema = new Schema({
topicName: String,
quesList: {
quesListName: {
type: String,
unique: true
},
by: String
}
});
但它畢竟是接受重複值
任何幫助,隨後的方法是高度更加感激ated
嘗試重新啓動蒙戈 – chirag
你'quesList'不是一個名單,但只是一個對象。你真的得到了什麼樣的重複?你能舉個例子嗎? – str
或參考此鏈接:http://stackoverflow.com/questions/27354834/mongoose-unique-true-not-work – chirag