AWS documentdb documentation change
Summary
Added new documentation page for the $gte query operator with examples in MongoDB Shell, Node.js, and Python
Security assessment
This is a routine documentation addition for a MongoDB query operator ($gte). The code examples include standard TLS connection parameters (tls=true, tlsCAFile=global-bundle.pem) which are normal security best practices for DocumentDB connections, but this doesn't indicate a specific security issue being addressed. The change appears to be standard feature documentation.
Diff
diff --git a/documentdb/latest/developerguide/gte.md b/documentdb/latest/developerguide/gte.md index 8b1378917..fa2c3df80 100644 --- a//documentdb/latest/developerguide/gte.md +++ b//documentdb/latest/developerguide/gte.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#gte "Open PDF") @@ -1,0 +3,105 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $gte + +The `$gte` operator in Amazon DocumentDB is used to match values that are greater than or equal to a specified value. This operator is useful for filtering and querying data based on numerical comparisons. + +**Parameters** + + * `field`: The field to check against the provided value. + + * `value`: The value to compare against the field. + + + + +## Example (MongoDB Shell) + +The following example demonstrates the usage of the `$gte` operator in Amazon DocumentDB to find all documents where the "age" field is greater than or equal to 25. + +**Create sample documents** + + + db.users.insertMany([ + { _id: 1, name: "John", age: 20 }, + { _id: 2, name: "Jane", age: 25 }, + { _id: 3, name: "Bob", age: 30 }, + { _id: 4, name: "Alice", age: 35 } + ]); + +**Query example** + + + db.users.find({ age: { $gte: 25 } }, { _id: 0, name: 1, age: 1 }); + +**Output** + + + { "name" : "Jane", "age" : 25 } + { "name" : "Bob", "age" : 30 } + { "name" : "Alice", "age" : 35 } + +## Code examples + +To view a code example for using the `$gte` command, choose the tab for the language that you want to use: + +Node.js + + + + const { MongoClient } = require('mongodb'); + + async function findUsersAboveAge(age) { + 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 users = db.collection('users'); + + const result = await users.find({ age: { $gte: age } }, { projection: { _id: 0, name: 1, age: 1 } }).toArray(); + console.log(result); + + await client.close(); + } + + findUsersAboveAge(25); + +Python + + + + from pymongo import MongoClient + + def find_users_above_age(age): + client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false') + db = client.test + users = db.users + + result = list(users.find({ 'age': { '$gte': age } }, { '_id': 0, 'name': 1, 'age': 1 })) + print(result) + + client.close() + + find_users_above_age(25) + + **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) + +$gt + +$in + +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.