AWS Security ChangesHomeSearch

AWS documentdb documentation change

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

File: documentdb/latest/developerguide/bitsAnyClear.md

Summary

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

Security assessment

This is routine documentation for a new query operator feature. The change shows standard usage examples with secure TLS connections (which is existing best practice) but does not indicate any security vulnerability being addressed or introduce new security features. The code examples use standard connection strings with TLS enabled, which is normal for database connectivity documentation.

Diff

diff --git a/documentdb/latest/developerguide/bitsAnyClear.md b/documentdb/latest/developerguide/bitsAnyClear.md
index 8b1378917..feb13d8e8 100644
--- a//documentdb/latest/developerguide/bitsAnyClear.md
+++ b//documentdb/latest/developerguide/bitsAnyClear.md
@@ -0,0 +1 @@
+[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#bitsAnyClear "Open PDF")
@@ -1,0 +3,104 @@
+[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
+
+Example (MongoDB Shell)Code examples
+
+# $bitsAnyClear
+
+The `$bitsAnyClear` operator in Amazon DocumentDB is used to match the documents where any of the specified bit in a field are cleared (set to 0). This can be useful for performing bitwise operations on field values stored in documents.
+
+**Parameters**
+
+  * `field`: The field to check.
+
+  * `value`: The numeric bitmask that specifies which bits should be checked, or a list of bits positions to be checked. A numeric bitmask can be a binary (0b...), decimal, hexadecimal (0x...), octal (0o...), or binary (BinData) form. In a list of bits positions, the position of the least significant bit is 0.
+
+
+
+
+## Example (MongoDB Shell)
+
+The following example demonstrates how to use the `$bitsAnyClear` operator to check if any bit is clear in the `status` field of the `items` collection.
+
+**Create sample documents**
+    
+    
+    db.items.insertMany([
+      { "_id": 1, "status": 7 },
+      { "_id": 2, "status": 15 },
+      { "_id": 3, "status": 31 }
+    ]);
+
+**Query example**
+    
+    
+    db.items.find({ "status": { $bitsAnyClear: 8 } })
+
+**Output**
+    
+    
+    { "_id" : 1, "status" : 7 }
+
+In this example, the query checks for documents where the `status` field has any bits clear (0) in the bitmask `8` (binary `1000`). The document with `status` values of `7` (binary `111`) matches the query, as it has at least one bit clear in the provided bitmask. The matching clear bit is the 4th least significant bit.
+
+## Code examples
+
+To view a code example for using the `$bitsAnyClear` 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('items');
+    
+      const result = await collection.find({ "status": { $bitsAnyClear: 8 } }).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.items
+    
+        result = list(collection.find({ "status": { "$bitsAnyClear": 8 } }))
+        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)
+
+$bitsAllSet
+
+$bitsAnySet
+
+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.