如何在猫鼬模式中位于数组内部的对象中访问array(arr)?
var userschema = mongoose.Schema({
email:String,
password:String,
add:String,
question:[String,],
ans:[
{
title:String,
arr:[String],
},
{
title:String,
arr:[String],
}
]
})
//accessing code
const m = new User;
m.email='myid@gmail.com',
m.password='something',
m.add='mmj',
m.question.push('mman');`enter code here`
m.ans[0] = {};
m.ans[0].title = 'something';
m.ans[0].arr.push('this is pushed')
`