such as
var PersonSchame = new mongoose.Schema({
name: String,
books: [{
type:String
}]
});
How to add data to books at this time?
Some basic questions:)
Do you mean to add an element to the books field of a piece of data in the database? If so, refer to the following example:
db.personModel.update({ _id: xxx // A specific piece of data was found }, { $push:{ members: username } }, (err) => { //callback function after //update operation });