AWS Security ChangesHomeSearch

AWS documentdb documentation change

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

File: documentdb/latest/developerguide/eq-aggregation.md

Summary

Added new documentation page for the $eq aggregation operator with examples in MongoDB Shell, Node.js, and Python, including connection strings with TLS configuration

Security assessment

The change adds documentation for a database operator and includes example connection strings that demonstrate security best practices (TLS=true, tlsCAFile parameter). This shows how to securely connect to DocumentDB but doesn't address a specific security vulnerability or incident.

Diff

diff --git a/documentdb/latest/developerguide/eq-aggregation.md b/documentdb/latest/developerguide/eq-aggregation.md
index 8b1378917..f5ef8308e 100644
--- a//documentdb/latest/developerguide/eq-aggregation.md
+++ b//documentdb/latest/developerguide/eq-aggregation.md
@@ -0,0 +1 @@
+[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#eq-aggregation "Open PDF")
@@ -1,0 +3,133 @@
+[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
+
+Example (MongoDB Shell)Code examples
+
+# $eq
+
+The `$eq` aggregation operator compares two values and returns `true` if they are equal, otherwise returns `false`.
+
+**Parameters**
+
+  * `expression1`: The first value to compare.
+
+  * `expression2`: The second value to compare.
+
+
+
+
+## Example (MongoDB Shell)
+
+The following example demonstrates using the `$eq` operator to check if product quantities match target values.
+
+**Create sample documents**
+    
+    
+    db.inventory.insertMany([
+      { _id: 1, item: "Widget", qty: 50, target: 50 },
+      { _id: 2, item: "Gadget", qty: 30, target: 50 },
+      { _id: 3, item: "Tool", qty: 50, target: 40 }
+    ]);
+
+**Query example**
+    
+    
+    db.inventory.aggregate([
+      {
+        $project: {
+          item: 1,
+          qty: 1,
+          target: 1,
+          meetsTarget: { $eq: ["$qty", "$target"] }
+        }
+      }
+    ]);
+
+**Output**
+    
+    
+    [
+      { _id: 1, item: 'Widget', qty: 50, target: 50, meetsTarget: true },
+      { _id: 2, item: 'Gadget', qty: 30, target: 50, meetsTarget: false },
+      { _id: 3, item: 'Tool', qty: 50, target: 40, meetsTarget: false }
+    ]
+
+## Code examples
+
+To view a code example for using the `$eq` aggregation operator, choose the tab for the language that you want to use:
+
+Node.js
+    
+    
+    
+    const { MongoClient } = require('mongodb');
+    
+    async function example() {
+      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('inventory');
+    
+      const result = await collection.aggregate([
+        {
+          $project: {
+            item: 1,
+            qty: 1,
+            target: 1,
+            meetsTarget: { $eq: ["$qty", "$target"] }
+          }
+        }
+      ]).toArray();
+    
+      console.log(result);
+      await client.close();
+    }
+    
+    example();
+
+Python
+    
+    
+    
+    from pymongo import MongoClient
+    
+    def example():
+        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['inventory']
+    
+        result = list(collection.aggregate([
+            {
+                '$project': {
+                    'item': 1,
+                    'qty': 1,
+                    'target': 1,
+                    'meetsTarget': { '$eq': ['$qty', '$target'] }
+                }
+            }
+        ]))
+    
+        print(result)
+        client.close()
+    
+    example()
+
+![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)
+
+$divide
+
+$exp
+
+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.