AWS documentdb documentation change
Summary
Added new documentation page for the $lte query operator with examples in MongoDB Shell, Node.js, and Python, including connection strings with TLS configuration
Security assessment
This change adds standard query 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 routine documentation of existing secure connection methods rather than addressing a specific security issue or adding new security documentation.
Diff
diff --git a/documentdb/latest/developerguide/lte.md b/documentdb/latest/developerguide/lte.md index 8b1378917..0a86e8795 100644 --- a//documentdb/latest/developerguide/lte.md +++ b//documentdb/latest/developerguide/lte.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#lte "Open PDF") @@ -1,0 +3,105 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $lte + +The `$lte` operator in Amazon DocumentDB is used to match documents where the value of a specified field is less than or equal to the specified value. This operator is useful for filtering and querying data based on numerical comparisons. + +**Parameters** + + * `field`: The field to compare. + + * `value`: The value to compare against. + + + + +## Example (MongoDB Shell) + +The following example demonstrates the usage of the `$lte` operator to retrieve documents where the `quantity` field is less than or equal to 10. + +**Create sample documents** + + + db.inventory.insertMany([ + { item: "canvas", qty: 100 }, + { item: "paint", qty: 50 }, + { item: "brush", qty: 10 }, + { item: "paper", qty: 5 } + ]); + +**Query example** + + + db.inventory.find({ qty: { $lte: 10 } }); + +**Output** + + + { "_id" : ObjectId("..."), "item" : "brush", "qty" : 10 }, + { "_id" : ObjectId("..."), "item" : "paper", "qty" : 5 } + +## Code examples + +To view a code example for using the `$lte` command, choose the tab for the language that you want to use: + +Node.js + + + + const { MongoClient } = require("mongodb"); + + async function main() { + 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("inventory"); + + const result = await collection.find({ qty: { $lte: 10 } }).toArray(); + console.log(result); + + await client.close(); + } + + main(); + +Python + + + + from pymongo import MongoClient + + def main(): + 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["inventory"] + + result = list(collection.find({ "qty": { "$lte": 10 } })) + print(result) + + client.close() + + if __name__ == "__main__": + main() + + **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) + +$mod + +$meta + +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.