AWS documentdb documentation change
Summary
Added documentation for the $lt aggregation 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 aggregation 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-aggregation.md b/documentdb/latest/developerguide/lt-aggregation.md index 8b1378917..4bcf5c61c 100644 --- a//documentdb/latest/developerguide/lt-aggregation.md +++ b//documentdb/latest/developerguide/lt-aggregation.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#lt-aggregation "Open PDF") @@ -1,0 +3,130 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $lt + +The `$lt` aggregation operator compares two values and returns `true` if the first value is less than the second, 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 `$lt` operator to identify low stock items. + +**Create sample documents** + + + db.warehouse.insertMany([ + { _id: 1, item: "Bolts", stock: 5 }, + { _id: 2, item: "Nuts", stock: 25 }, + { _id: 3, item: "Screws", stock: 8 } + ]); + +**Query example** + + + db.warehouse.aggregate([ + { + $project: { + item: 1, + stock: 1, + lowStock: { $lt: ["$stock", 10] } + } + } + ]); + +**Output** + + + [ + { _id: 1, item: 'Bolts', stock: 5, lowStock: true }, + { _id: 2, item: 'Nuts', stock: 25, lowStock: false }, + { _id: 3, item: 'Screws', stock: 8, lowStock: true } + ] + +## Code examples + +To view a code example for using the `$lt` 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('warehouse'); + + const result = await collection.aggregate([ + { + $project: { + item: 1, + stock: 1, + lowStock: { $lt: ["$stock", 10] } + } + } + ]).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['warehouse'] + + result = list(collection.aggregate([ + { + '$project': { + 'item': 1, + 'stock': 1, + 'lowStock': { '$lt': ['$stock', 10] } + } + } + ])) + + 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) + +$log10 + +$lte + +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.