Db.getcollection (' my_booking '). Find ({"Hospitalname":/xx Hospital/,openid:/^2/}). ForEach (
function (item) {
Db.getcollection (' my_booking '). Update ({"_id": item._id},{$set: {"PayType": "1"}}
)
Query out Hospitalname is XX hospital and OpenID all records beginning with 2, and update my_booking table in PayType is 1.
Db.getcollection (' my_booking '). Find ({"Hospitalname":/xx hospital/,openid:{$not:/^2/}}). ForEach (
function (item) {
db.getcollection (' my_booking '). Update ({"_id": item._id},{$set: {"PayType": "2"}}
)
The query out Hospitalname is XX hospital and OpenID does not start with 2 of all records, and update my_booking table in the PayType is 2.
Db.getcollection (' my_booking '). Find ({"Hospitalname":/Yuncheng City Center Hospital/,openid:{$not:/^2/}}). ForEach (
function (item) {
db.getcollection (' my_booking '). Update ({"_id": item._id},{$set: {"OutTradeNo1": Item.outtradeno2}})
}
)
Check out all records of the XX hospital and the OpenID beginning with 2, and assign the OutTradeNo2 of each record to outTradeNo1.