AWS Security ChangesHomeSearch

AWS documentdb documentation change

Service: documentdb · 2026-03-28 · Documentation low

File: documentdb/latest/developerguide/replaceWith.md

Summary

Entire documentation page for the $replaceWith aggregation operator has been removed, including syntax, parameters, examples in MongoDB Shell, Node.js, and Python, and all related content.

Security assessment

This change removes documentation for a specific aggregation operator ($replaceWith) but does not contain any evidence of addressing a security vulnerability, weakness, or incident. The removal appears to be a documentation restructuring or deprecation of content rather than a security-related fix. No security implications are mentioned in the removed content.

Diff

diff --git a/documentdb/latest/developerguide/replaceWith.md b/documentdb/latest/developerguide/replaceWith.md
index bcde52807..8b1378917 100644
--- a//documentdb/latest/developerguide/replaceWith.md
+++ b//documentdb/latest/developerguide/replaceWith.md
@@ -1 +0,0 @@
-[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#replaceWith "Open PDF")
@@ -3,147 +1,0 @@
-[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
-
-Example (MongoDB Shell)Code examples
-
-# $replaceWith
-
-New from version 8.0
-
-Not supported by Elastic cluster.
-
-The `$replaceWith` aggregation stage in Amazon DocumentDB is used to replace the input document with a new document. All existing fields on the input document, including the _id field, are replaced by the new document. `$replaceWith` is commonly used to flatten documents, or promote an embedded document to the top level.
-
-**Parameters**
-
-  * `<replacement>` (required): The new document that will replace the existing document.
-
-
-
-
-## Example (MongoDB Shell)
-
-The following example demonstrates how to use the `$replaceWith` operator to replace an existing document in an Amazon DocumentDB collection.
-
-**Create sample documents**
-    
-    
-    db.restaurants.insertMany([
-      {
-        "restaurantId": "REST-0Y9GL0",
-        "name": "Biryani Adda",
-        "cuisine": "Indian",
-        "ratings": [ 3, 4, 3, 2, 2, 4, 1, 5, 5, 5 ]
-      },
-      {
-        "restaurantId": "REST-8L2PX9",
-        "name": "The Burger Spot",
-        "cuisine": "American",
-        "ratings": [ 2, 3, 4, 5, 3, 1, 1, 2, 4 ]
-      }
-    ]);
-
-**Query example**
-    
-    
-    db.restaurants.aggregate([
-      { $replaceWith: {
-          name: "$name",
-          cuisine: "$cuisine",
-          rating: { $avg: "$ratings" }
-        }
-      }
-    ]);
-
-**Output**
-    
-    
-    [
-      {
-        name: 'Biryani Adda',
-        cuisine: 'Indian',
-        rating: 3.4
-      },
-      {
-        name: 'The Burger Spot',
-        cuisine: 'American',
-        rating: 2.7777777777777777
-      }
-    ]
-
-## Code examples
-
-To view a code example for using the `$replaceWith` command, choose the tab for the language that you want to use:
-
-Node.js
-    
-    
-    
-    const { MongoClient } = require('mongodb');
-    
-    async function replaceDoc() {
-      const client = await MongoClient.connect('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false');
-      const db = client.db('test');
-      const collection = db.collection('restaurants');
-    
-      const result = await collection.aggregate([
-        { $replaceWith: {
-            name: "description_index",
-            cuisine: 2,
-            rating: { $avg: "$ratings" }
-          }
-        }
-      ]).toArray();
-    
-      console.log(result);
-      client.close();
-    }
-    
-    replaceDoc();
-
-Python
-    
-    
-    
-    from pymongo import MongoClient
-    
-    
-    def replace_document():
-        client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false')
-        db = client.test
-        collection = db.restaurants
-    
-        result = list(collection.aggregate([
-            {
-                '$replaceWith': {
-                    'name': "$name",
-                    'cuisine': "$cuisine",
-                    'rating': { '$avg': "$ratings"}
-                }
-            }
-        ]))
-    
-        print(result)
-        client.close()
-    
-    replace_document()
-
-![Warning](https://d1ge0kk1l5kms0.cloudfront.net/images/G/01/webservices/console/warning.png) **Javascript is disabled or is unavailable in your browser.**
-
-To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions.
-
-[Document Conventions](/general/latest/gr/docconventions.html)
-
-$replaceRoot
-
-$reverseArray
-
-Did this page help you? - Yes
-
-Thanks for letting us know we're doing a good job!
-
-If you've got a moment, please tell us what we did right so we can do more of it.
-
-Did this page help you? - No
-
-Thanks for letting us know this page needs work. We're sorry we let you down.
-
-If you've got a moment, please tell us how we can make the documentation better.