AWS documentdb documentation change
Summary
Added documentation for the $ceil operator in Amazon DocumentDB, including description, parameters, examples in MongoDB shell, and code examples in Node.js and Python
Security assessment
This change adds routine documentation for a mathematical operator ($ceil) in Amazon DocumentDB. The code examples show standard connection strings with TLS enabled, but this is standard practice for database connections and not indicative of addressing a specific security vulnerability. There is no mention of security patches, vulnerabilities, or security incidents in the documentation.
Diff
diff --git a/documentdb/latest/developerguide/ceil.md b/documentdb/latest/developerguide/ceil.md index 8b1378917..609f1e068 100644 --- a//documentdb/latest/developerguide/ceil.md +++ b//documentdb/latest/developerguide/ceil.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#ceil "Open PDF") @@ -1,0 +3,116 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $ceil + +New from version 4.0 + +The `$ceil` operator in Amazon DocumentDB, as in MongoDB, rounds a number up to the nearest integer. This is useful when you need to perform mathematical operations on numeric fields and ensure the result is a whole number. + +**Parameters** + + * `expression`: The numeric expression to round up. + + + + +## Example (MongoDB Shell) + +This example demonstrates how to use the `$ceil` operator to round up a numeric field. + +**Create sample documents** + + + db.numbers.insertMany([ + { "_id": 1, "value": 3.14 }, + { "_id": 2, "value": -2.7 }, + { "_id": 3, "value": 0 } + ]) + +**Query example** + + + db.numbers.aggregate([ + { $project: { + "roundedUp": { $ceil: "$value" } + }} + ]) + +**Output** + + + { "_id": 1, "roundedUp": 4 } + { "_id": 2, "roundedUp": -2 } + { "_id": 3, "roundedUp": 0 } + +## Code examples + +To view a code example for using the `$ceil` command, 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('numbers'); + + const result = await collection.aggregate([ + { $project: { + "roundedUp": { $ceil: "$value" } + }} + ]).toArray(); + + console.log(result); + 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.numbers + + result = list(collection.aggregate([ + { '$project': { + "roundedUp": { '$ceil': "$value" } + }} + ])) + + 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) + +$bucket + +$changeStream + +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.