How to use mongoose to query embedded data?

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.


two methods:

1. Remove the option of _ id when creating an array model.
  mongo official website  

Note:
  • the above is the result of local operation.
  • The version of mongoose used by
  • is 5.2.5
  • mongo version: 3.4
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34800-2bf0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34800-2bf0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?