我想知道如何在moongoose綱要中添加一個字符串數組。貓鼬綱要如何添加數組
我有以下的代碼,但它不工作:
var message = new Schema({
topic: String,
content: String,
restriction:String,
sender:String,
reciever:String,
users:[String],
read:{type: String, default: 'no'},
like:{ type: Number, default: 0 },
created_at: {type: Date, default: Date.now}
});
我談論users
。你能幫我嗎?
每個文檔:http://mongoosejs.com/docs/schematypes.html'用戶:[字符串]'工作正常,因爲你寫了它。你可以詳細解釋一下哪些代碼不適用? – Paul