How to rename a field name inside nested array?

Hello @Krishna, Welcome to MongoDB community forum,

You can try update with aggregation pipeline starting from MongoDB 4.2,

  • $map to iterate loop of Orders array
  • $map to iterate loop of Items array and rename StockCode property to ArticleNo and return other fields
  • $mergeObjects to merge current object of Orders and update property Items
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"
                    }
                  }
                }
              }
            ]
          }
        }
      }
    }
  }]
)