标签:mon tco creat use history span customer iso ted
db.getCollection(‘photos‘).findOneAndUpdate("5b028e71f32bd5004f905879", //findByIdAndUpdate
{
‘$push‘:{ ‘orderHistory‘:{
"userId":"5b10d49320b805a7844ae5ec",
"customerId":"888888888888",
"createdOn":ISODate("2018-06-01T21:29:57.141+08:00")
}
}
},{
‘upsert‘: true
})
mongoDB,mongoose,没有数组就添加,如果有了数组,就向数组中添加新元素
标签:mon tco creat use history span customer iso ted
原文地址:https://www.cnblogs.com/qiyc/p/9132251.html