Untitled
unknown
plain_text
a year ago
499 B
9
Indexable
db.global_config.aggregate([
{
$lookup: {
from: "country_region",
localField: "CountryCode",
foreignField: "CountryCode",
as: "countryInfo"
}
},
{
$unwind: "$countryInfo"
},
{
$set: {
RegionCode: "$countryInfo.RegionCode"
}
},
{
$project: {
countryInfo: 0
}
}
]).forEach(function(doc) {
db.global_config.updateOne(
{ _id: doc._id },
{ $set: { RegionCode: doc.RegionCode } }
);
});Editor is loading...
Leave a Comment