AWS documentdb documentation change
Summary
Added documentation for the $lt query operator with MongoDB shell examples and Node.js/Python code examples showing connection strings with TLS parameters
Security assessment
This change adds standard documentation for a MongoDB query operator ($lt) with code examples. The connection strings include TLS parameters (tls=true, tlsCAFile=global-bundle.pem) which are standard security practices for encrypted connections, but this is routine documentation of existing security features rather than addressing a specific security issue. No evidence of vulnerability remediation or security incident response.
Diff
diff --git a/documentdb/latest/developerguide/lt.md b/documentdb/latest/developerguide/lt.md index 8b1378917..afaa00323 100644 --- a//documentdb/latest/developerguide/lt.md +++ b//documentdb/latest/developerguide/lt.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#lt "Open PDF") @@ -1,0 +3,103 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $lt + +The `$lt` operator in Amazon DocumentDB is used to match values that are less than the specified value. This operator is useful for filtering and querying data based on numerical comparisons. + +**Parameters** + + * `field`: The field name to check. + + * `value`: The value to compare against. + + + + +## Example (MongoDB Shell) + +The following example demonstrates how to use the `$lt` operator to retrieve documents where the `Inventory.OnHand` value is less than 50. + +**Create sample documents** + + + db.example.insertMany([ + { "_id": 1, "Inventory": { "OnHand": 25, "Sold": 60 }, "Colors": ["Red", "Blue"] }, + { "_id": 2, "Inventory": { "OnHand": 75, "Sold": 40 }, "Colors": ["Red", "White"] }, + { "_id": 3, "Inventory": { "OnHand": 10, "Sold": 85 }, "Colors": ["Red", "Green"] } + ]); + +**Query example** + + + db.example.find({ "Inventory.OnHand": { $lt: 50 } }) + +**Output** + + + { "_id" : 1, "Inventory" : { "OnHand" : 25, "Sold" : 60 }, "Colors" : [ "Red", "Blue" ] } + { "_id" : 3, "Inventory" : { "OnHand" : 10, "Sold" : 85 }, "Colors" : [ "Red", "Green" ] } + +## Code examples + +To view a code example for using the `$lt` 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('example'); + + const result = await collection.find({ "Inventory.OnHand": { $lt: 50 } }).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['example'] + + result = list(collection.find({ "Inventory.OnHand": { "$lt": 50 } })) + print(result) + + client.close() + + example() + + **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) + +$jsonSchema + +$mod + +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.