AWS documentdb documentation change
Summary
Added comprehensive documentation for the $pow operator in Amazon DocumentDB, including introduction, parameters, MongoDB Shell example, and code examples in Node.js and Python with connection details
Security assessment
This change adds documentation for a mathematical operator ($pow) in Amazon DocumentDB's aggregation framework. The documentation includes standard connection examples with TLS parameters, but there is no evidence of addressing a specific security vulnerability or weakness. The TLS parameters shown are standard security best practices for DocumentDB connections, not new security features or fixes.
Diff
diff --git a/documentdb/latest/developerguide/pow.md b/documentdb/latest/developerguide/pow.md index 8b1378917..69f65c94b 100644 --- a//documentdb/latest/developerguide/pow.md +++ b//documentdb/latest/developerguide/pow.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#pow "Open PDF") @@ -1,0 +3,118 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $pow + +Introduced in 8.0 + +The `$pow` operator in Amazon DocumentDB allows you to raise a number to a power. This can be useful for performing exponential calculations within your aggregation pipeline. + +**Parameters** + + * `<number>` (required): The number to be raised to a power. + + * `<exponent>` (required): The power to which the number should be raised. + + + + +## Example (MongoDB Shell) + +The following example demonstrates how to use the `$pow` operator to calculate the square of a number. + +**Create sample documents** + + + db.numbers.insertMany([ + { "_id": 1, "value": 2 }, + { "_id": 2, "value": 3 }, + { "_id": 3, "value": 4 } + ]); + +**Query example** + + + db.numbers.aggregate([ + { $addFields: { "square": { $pow: ["$value", 2] } } } + ]) + +**Output** + + + [ + { "_id": 1, "value": 2, "square": 4 }, + { "_id": 2, "value": 3, "square": 9 }, + { "_id": 3, "value": 4, "square": 16 } + ] + +## Code examples + +To view a code example for using the `$pow` command, choose the tab for the language that you want to use: + +Node.js + + +Here's an example of using the $pow operator in a Node.js application: + + + 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('numbers'); + + const result = await collection.aggregate([ + { $addFields: { "square": { $pow: ["$value", 2] } } } + ]).toArray(); + + console.log(result); + await client.close(); + } + + example(); + +Python + + +Here's an example of using the $pow operator in a Python application: + + + 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['numbers'] + + result = list(collection.aggregate([ + { "$addFields": { "square": { "$pow": ["$value", 2] } } } + ])) + + 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) + +$out + +$push + +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.