AWS Security ChangesHomeSearch

AWS documentdb documentation change

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

File: documentdb/latest/developerguide/setDifference.md

Summary

Entire documentation page for the $setDifference operator has been removed, including all examples and usage instructions.

Security assessment

The change removes general documentation about a MongoDB aggregation operator ($setDifference) with no mention of security vulnerabilities, incidents, or security features. The content removed includes basic usage examples and code samples without any security context.

Diff

diff --git a/documentdb/latest/developerguide/setDifference.md b/documentdb/latest/developerguide/setDifference.md
index 02edc7b0e..8b1378917 100644
--- a//documentdb/latest/developerguide/setDifference.md
+++ b//documentdb/latest/developerguide/setDifference.md
@@ -1 +0,0 @@
-[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#setDifference "Open PDF")
@@ -3,149 +1,0 @@
-[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
-
-Example (MongoDB Shell)Code examples
-
-# $setDifference
-
-New from version 4.0.
-
-The `$setDifference` operator in Amazon DocumentDB is used to compare two sets and return the elements that are in the first set but not in the second set. This operator is useful for finding the unique elements between two sets.
-
-**Parameters**
-
-  * `firstSet` : The first set to compare.
-
-  * `secondSet` : The second set to compare.
-
-
-
-
-## Example (MongoDB Shell)
-
-The following example demonstrates how to use the `$setDifference` operator to find the unique elements between two sets.
-
-**Create sample documents**
-    
-    
-    db.collection.insertMany([
-      { _id: 1, fruits: ["apple", "banana", "cherry", "date"] },
-      { _id: 2, fruits: ["banana", "cherry", "date", "elderberry"] }
-    ]);
-
-**Query example**
-    
-    
-    db.collection.aggregate([
-      {
-        $project: {
-          uniqueFruits: { $setDifference: ["$fruits", ["banana", "cherry", "date"]] }
-        }
-      }
-    ]);
-
-**Output**
-    
-    
-    [
-      { "_id": 1, "uniqueFruits": ["apple"] },
-      { "_id": 2, "uniqueFruits": ["elderberry"] }
-    ]
-
-The query performs the following steps:
-
-1\. It uses the `$project` stage to create a new field `uniqueFruits` for each document.
-
-2\. The `$setDifference` operator compares the `fruits` array with the array `["banana", "cherry", "date"]` and returns the unique elements in the `fruits` array.
-
-## Code examples
-
-To view a code example for using the `$setDifference` command, choose the tab for the language that you want to use:
-
-Node.js
-    
-
-Here's an example of how to use the `$setDifference` operator in a Node.js application:
-    
-    
-    const { MongoClient } = require('mongodb');
-    
-    async function main() {
-      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('mycollection');
-    
-      // Insert sample documents
-      await collection.insertMany([
-        { _id: 1, fruits: ["apple", "banana", "cherry", "date"] },
-        { _id: 2, fruits: ["banana", "cherry", "date", "elderberry"] }
-      ]);
-    
-     // Query using $setDifference
-      const result = await collection.aggregate([
-        {
-          $project: {
-            uniqueFruits: { $setDifference: ["$fruits", ["banana", "cherry", "date"]] }
-          }
-        }
-      ]).toArray();
-    
-      console.log(result);
-      await client.close();
-    }
-    
-    main();
-
-Python
-    
-
-Here's an example of how to use the `$setDifference` operator in a Python application:
-    
-    
-    from pymongo import MongoClient
-    
-    def main():
-        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['mycollection']
-    
-        # Insert sample documents
-        collection.insert_many([
-            {'_id': 1, 'fruits': ["apple", "banana", "cherry", "date"]},
-            {'_id': 2, 'fruits': ["banana", "cherry", "date", "elderberry"]}
-        ])
-    
-        # Query using $setDifference
-        result = list(collection.aggregate([
-            {
-                '$project': {
-                    'uniqueFruits': {'$setDifference': ['$fruits', ["banana", "cherry", "date"]]}
-                }
-            }
-        ]))
-    
-        print(result)
-        client.close()
-    
-    if __name__ == '__main__':
-        main()
-
-![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)
-
-$set
-
-$setEquals
-
-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.