Like the example below, if I want to add or delete documents to the lists array, what should I do? Thanks!
{
"_id" : ObjectId("590a77315a7ae88824b296cf"),
"user" : "yejia@qq.com",
"password" : "5475442343",
"lists" : [
{
"create_at" : "1234",
"update_at" : "1234",
"title" : "yejia",
"list_id" : 123
}
]
}
pull and push are the same as MongoDB Node.JS Driver.
Refer to the following usage:
Model.update({ }, {’$pull’:{ } } );
Model.update({ }, {’$push’:{ } } );
For reference
Love MongoDB! Have Fun!
The syntax reference for Mongoose’s pull and push is as follows: