Hello @Krishna, Welcome to MongoDB community forum,
You can try update with aggregation pipeline starting from MongoDB 4.2,
-
$mapto iterate loop ofOrdersarray -
$mapto iterate loop ofItemsarray and renameStockCodeproperty toArticleNoand return other fields -
$mergeObjectsto merge current object ofOrdersand update propertyItems
db.collection.updateMany(
{},
[{
$set: {
"Configuration.Orders": {
$map: {
input: "$Configuration.Orders",
in: {
$mergeObjects: [
"$$this",
{
Items: {
$map: {
input: "$$this.Items",
in: {
ArticleNo: "$$this.StockCode",
OrderedQuantity: "$$this.OrderedQuantity"
}
}
}
}
]
}
}
}
}
}]
)