我正在尝试使用Chrome postman工具通过发布原始JSON数据来测试我的Nodejs api服务器,但我无法弄清楚如何发布数组或对象数组。下面是我的mongodb架构和我尝试从Chrome邮递员发送以测试保存功能的json。有人可以告诉我这里我错过了什么/做错了,谢谢。
var memberSchema = new Schema({
name: {
type: String
}
});
module.exports = mongoose.model('Member', memberSchema);
var commentPics = new Schema({
url: {
type: String,
trim: true,
max: 1000
}
});
var comment = new Schema({
subject: String,
body: {
type: String,
trim: true,
max: 2000
},
dateAdded: {
type: Date,
default: Date.now
},
pics:[commentPics],
members:[type: Schema.ObjectId, ref: 'Member']
});
Data posted by Chrome - Postman
{"subject":"New comment", "body":"this is a test", "pics.url":"http://www.google.com", "members":"[123456, 567890]"}