AWS documentdb documentation change
Summary
Added new documentation page for the $lte aggregation operator with examples in MongoDB Shell, Node.js, and Python, including connection strings with TLS configuration
Security assessment
This change adds standard operator documentation with code examples. The connection strings include TLS parameters (tls=true, tlsCAFile=global-bundle.pem) which are standard security practices for DocumentDB connections, but this is not introducing new security documentation - it's just showing standard secure connection patterns that were likely already documented elsewhere.
Diff
diff --git a/documentdb/latest/developerguide/lte-aggregation.md b/documentdb/latest/developerguide/lte-aggregation.md index 8b1378917..1b6000040 100644 --- a//documentdb/latest/developerguide/lte-aggregation.md +++ b//documentdb/latest/developerguide/lte-aggregation.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#lte-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 + +# $lte + +The `$lte` aggregation operator compares two values and returns `true` if the first value is less than or equal to 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 `$lte` operator to identify budget-friendly items. + +**Create sample documents** + + + db.menu.insertMany([ + { _id: 1, dish: "Salad", price: 8 }, + { _id: 2, dish: "Pasta", price: 12 }, + { _id: 3, dish: "Soup", price: 6 } + ]); + +**Query example** + + + db.menu.aggregate([ + { + $project: { + dish: 1, + price: 1, + affordable: { $lte: ["$price", 10] } + } + } + ]); + +**Output** + + + [ + { _id: 1, dish: 'Salad', price: 8, affordable: true }, + { _id: 2, dish: 'Pasta', price: 12, affordable: false }, + { _id: 3, dish: 'Soup', price: 6, affordable: true } + ] + +## Code examples + +To view a code example for using the `$lte` 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('menu'); + + const result = await collection.aggregate([ + { + $project: { + dish: 1, + price: 1, + affordable: { $lte: ["$price", 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['menu'] + + result = list(collection.aggregate([ + { + '$project': { + 'dish': 1, + 'price': 1, + 'affordable': { '$lte': ['$price', 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) + +$lt + +$lookup + +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.