AWS Security ChangesHomeSearch

AWS documentdb documentation change

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

File: documentdb/latest/developerguide/allElementsTrue.md

Summary

Added new documentation page for the $allElementsTrue operator in Amazon DocumentDB, including description, MongoDB Shell example, and code examples in Node.js and Python

Security assessment

This change adds documentation for a MongoDB query operator ($allElementsTrue) which is a standard database feature for evaluating array conditions. There is no mention of security vulnerabilities, patches, or security features in the content. The code examples show standard database connectivity without any security-specific configurations or warnings.

Diff

diff --git a/documentdb/latest/developerguide/allElementsTrue.md b/documentdb/latest/developerguide/allElementsTrue.md
index 8b1378917..473947512 100644
--- a//documentdb/latest/developerguide/allElementsTrue.md
+++ b//documentdb/latest/developerguide/allElementsTrue.md
@@ -0,0 +1 @@
+[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#allElementsTrue "Open PDF")
@@ -1,0 +3,115 @@
+[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
+
+Example (MongoDB Shell)Code examples
+
+# $allElementsTrue
+
+New from version 4.0
+
+The `$allElementsTrue` operator is used to check if all elements in an array evaluate to a true value.
+
+**Parameters**
+
+  * `expression`: An expression that evaluates to an array.
+
+
+
+
+## Example (MongoDB Shell)
+
+The following example demonstrates the usage of `$allElementsTrue` to check if all elements in an array are true.
+
+**Create sample documents**
+    
+    
+    db.collection.insert([
+      { "name": "John", "scores": [100, 90, 80] },
+      { "name": "Jane", "scores": [80, 85, 0] },
+      { "name": "Bob", "scores": [90, 95, null] }
+    ])
+
+**Query example**
+    
+    
+    db.collection.find({
+      "scores": { "$allElementsTrue": [{ "$gt": 0 }] }
+    })
+
+**Output**
+    
+    
+    [
+      { "_id" : ObjectId("..."), "name" : "John", "scores" : [ 100, 90, 80 ] },
+      { "_id" : ObjectId("..."), "name" : "Bob", "scores" : [ 90, 95, null ] }
+    ]
+
+In this example, the query checks if all elements in the `scores` array are greater than 0. The document with `"name": "Jane"` is excluded because the `scores` array contains a 0, which is a falsy value.
+
+## Code examples
+
+To view a code example for using the `$allElementsTrue` command, 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('collection');
+    
+      const result = await collection.find({
+        "scores": { "$allElementsTrue": [{ "$gt": 0 }] }
+      }).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['collection']
+    
+        result = list(collection.find({
+            "scores": {"$allElementsTrue": [{"$gt": 0}]}
+        }))
+    
+        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)
+
+$addFields
+
+$and
+
+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.