const userSchema = new Schema({
name:{type:String},
clubnumber:{type:String},
memo:[{
memos:{type:String}
}]
})
the data structure is as above. Now you want to match name and clubnumber, to query all the memo under the library
db.userModel.findOne({name:name,clubnumber:clubnumber},(e,d)=>{
console.log(d.memo);
})
if I write this, the data from the console is
.[
{ memos:xxx,id:xxxx},
{ memos:xxx1,id:xxxxx}
]
the data structure I want is
{memos1,memos2,memos3}//memos
now I can think of recreating an array by traversing, but do any great gods know what mongoose can do to get such an array directly? thank you very much.