AWS documentdb documentation change
Summary
Added new documentation page for the $gte aggregation operator with examples in MongoDB Shell, Node.js, and Python
Security assessment
This is a routine documentation addition for a MongoDB aggregation 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-aggregation.md b/documentdb/latest/developerguide/gte-aggregation.md index 8b1378917..3dad4d484 100644 --- a//documentdb/latest/developerguide/gte-aggregation.md +++ b//documentdb/latest/developerguide/gte-aggregation.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#gte-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 + +# $gte + +The `$gte` aggregation operator compares two values and returns `true` if the first value is greater 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 `$gte` operator to check if students passed an exam. + +**Create sample documents** + + + db.students.insertMany([ + { _id: 1, name: "Alice", score: 85 }, + { _id: 2, name: "Bob", score: 60 }, + { _id: 3, name: "Charlie", score: 72 } + ]); + +**Query example** + + + db.students.aggregate([ + { + $project: { + name: 1, + score: 1, + passed: { $gte: ["$score", 70] } + } + } + ]); + +**Output** + + + [ + { _id: 1, name: 'Alice', score: 85, passed: true }, + { _id: 2, name: 'Bob', score: 60, passed: false }, + { _id: 3, name: 'Charlie', score: 72, passed: true } + ] + +## Code examples + +To view a code example for using the `$gte` 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('students'); + + const result = await collection.aggregate([ + { + $project: { + name: 1, + score: 1, + passed: { $gte: ["$score", 70] } + } + } + ]).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['students'] + + result = list(collection.aggregate([ + { + '$project': { + 'name': 1, + 'score': 1, + 'passed': { '$gte': ['$score', 70] } + } + } + ])) + + 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) + +$gt + +$hour + +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.