AWS Security ChangesHomeSearch

AWS documentdb documentation change

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

File: documentdb/latest/developerguide/or.md

Summary

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

Security assessment

This change adds standard documentation for a MongoDB query operator ($or) with no mention of security vulnerabilities, patches, or security incidents. The code examples include TLS connection parameters (tls=true, tlsCAFile=global-bundle.pem) which are standard secure connection practices for DocumentDB, but this is routine documentation of existing security features rather than addressing a specific security issue.

Diff

diff --git a/documentdb/latest/developerguide/or.md b/documentdb/latest/developerguide/or.md
index 8b1378917..69ac69036 100644
--- a//documentdb/latest/developerguide/or.md
+++ b//documentdb/latest/developerguide/or.md
@@ -0,0 +1 @@
+[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#or "Open PDF")
@@ -1,0 +3,133 @@
+[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
+
+Example (MongoDB Shell)Code examples
+
+# $or
+
+The `$or` operator is used to perform a logical OR operation on an array of two or more expressions. It returns documents that match at least one of the expressions. This operator is useful when you need to query for documents that satisfy any one of multiple conditions.
+
+**Parameters**
+
+  * `expression1`: The first expression to evaluate.
+
+  * `expression2`: The second expression to evaluate.
+
+  * `...`: Additional expressions to evaluate (optional).
+
+
+
+
+## Example (MongoDB Shell)
+
+The following example demonstrates the usage of the `$or` operator to find documents where the `make` is either "TruckForYou" with the model "Heavy H1" or "SportForYou" with the model "Bolid 1".
+
+**Create sample documents**
+    
+    
+    db.cars.insertMany([
+      { make: "TruckForYou", model: "Heavy H1", year: 2020 },
+      { make: "SportForYou", model: "Bolid 1", year: 2021 },
+      { make: "TruckForYou", model: "Cargo 5", year: 2019 },
+      { make: "SportForYou", model: "Racer 2", year: 2022 }
+    ]);
+
+**Query example**
+    
+    
+    db.cars.find({
+      $or: [
+        { make: "TruckForYou", model: "Heavy H1" },
+        { make: "SportForYou", model: "Bolid 1" }
+      ]
+    });
+
+**Output**
+    
+    
+    [
+      {
+        _id: ObjectId('...'),
+        make: 'TruckForYou',
+        model: 'Heavy H1',
+        year: 2020
+      },
+      {
+        _id: ObjectId('...'),
+        make: 'SportForYou',
+        model: 'Bolid 1',
+        year: 2021
+      }
+    ]
+
+## Code examples
+
+To view a code example for using the `$or` command, choose the tab for the language that you want to use:
+
+Node.js
+    
+    
+    
+    const { MongoClient } = require('mongodb');
+    
+    async function findCarsByMakeModel() {
+      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 cars = db.collection('cars');
+    
+      const result = await cars.find({
+        $or: [
+          { make: "TruckForYou", model: "Heavy H1" },
+          { make: "SportForYou", model: "Bolid 1" }
+        ]
+      }).toArray();
+    
+      console.log(result);
+      client.close();
+    }
+    
+    findCarsByMakeModel();
+
+Python
+    
+    
+    
+    from pymongo import MongoClient
+    
+    def find_cars_by_make_model():
+        client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false')
+        db = client['test']
+        cars = db.cars
+    
+        result = list(cars.find({
+            '$or': [
+                {'make': 'TruckForYou', 'model': 'Heavy H1'},
+                {'make': 'SportForYou', 'model': 'Bolid 1'}
+            ]
+        }))
+    
+        print(result)
+        client.close()
+    
+    find_cars_by_make_model()
+
+![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)
+
+$not
+
+$regex
+
+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.