AWS documentdb documentation change
Summary
Added documentation for the $exp operator (exponential function) in Amazon DocumentDB aggregation framework, including parameters, MongoDB shell examples, and code examples in Node.js and Python
Security assessment
This change adds routine documentation for a mathematical aggregation operator ($exp) in Amazon DocumentDB. The documentation includes standard connection examples with authentication and TLS parameters, but there's no evidence of addressing security vulnerabilities or adding new security features. The change appears to be standard feature documentation update.
Diff
diff --git a/documentdb/latest/developerguide/exp.md b/documentdb/latest/developerguide/exp.md index 8b1378917..b58cbe842 100644 --- a//documentdb/latest/developerguide/exp.md +++ b//documentdb/latest/developerguide/exp.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#exp "Open PDF") @@ -1,0 +3,122 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $exp + +New from version 4.0 + +The `$exp` operator in Amazon DocumentDB allows you to raise the constant e to a given number. + +**Parameters** + + * `expression`: The expression to evaluate. This can be any valid aggregation expression, including field references, arithmetic operations, and other aggregation stages. + + + + +## Example (MongoDB Shell) + +The following example demonstrates the use of the `$exp` operator to find all documents where the `quantity` field is greater than the `price` field. + +**Create sample documents** + + + db.items.insertMany([ + { item: "canvas", quantity: 4 }, + { item: "journal", quantity: 2 } + ]); + +**Query example** + + + db.items.aggregate([ + { $project: { + "quantityRaised": {$exp: "$quantity"}} + } + ]); + +**Output** + + + [ + { + _id: ObjectId('6920b785311cf98b79d2950d'), + quantityRaised: 54.598150033144236 + }, + { + _id: ObjectId('6920b785311cf98b79d2950e'), + quantityRaised: 7.38905609893065 + } + ] + +## Code examples + +To view a code example for using the `$exp` command, choose the tab for the language that you want to use: + +Node.js + + + + const { MongoClient } = require('mongodb'); + + async function aggregateExp() { + 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 items = db.collection('items'); + + const result = await items.aggregate([ + { $project: { + "quantityRaised": {$exp: "$quantity"}} + } + ]).toArray(); + + console.log(result); + client.close(); + } + + aggregateExp(); + +Python + + + + from pymongo import MongoClient + + def aggregate_exp(): + client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false') + db = client.test + items = db.items + + result = list(items.aggregate([ + { "$project": { + "quantityRaised": {"$exp": "$quantity"}} + } + ])) + + print(result) + client.close() + + aggregate_exp() + + **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) + +$eq + +$filter + +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.