I am running this query to add new field in my document, and it run successfully but does not update the document in mongodb.(movies is the collection name, mongodb version - 4.2.15 Community)
db.movies.aggregate([{
$addFields: {
totalHomework: "123312" ,
totalQuiz: "12312"
}}])
update
db.collection.update({},
{
$set: {
totalHomework: "123312",
totalQuiz: "12312"
}
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.