AWS documentdb documentation change
Summary
Entire documentation file for the $sum operator was removed, including all content, examples, and code samples
Security assessment
This change appears to be a complete removal of documentation content for the $sum operator in Amazon DocumentDB. There is no evidence in the diff that this removal is related to a security vulnerability, weakness, or incident. The removed content includes standard documentation, examples, and code samples without any security warnings or vulnerability disclosures. This appears to be routine documentation maintenance or restructuring rather than a security-related change.
Diff
diff --git a/documentdb/latest/developerguide/sum.md b/documentdb/latest/developerguide/sum.md index f4602800b..8b1378917 100644 --- a//documentdb/latest/developerguide/sum.md +++ b//documentdb/latest/developerguide/sum.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#sum "Open PDF") @@ -3,139 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $sum - -The `$sum` operator in Amazon DocumentDB returns the sum of the specified expression for each document in a group. It is a group accumulator operator that is typically used in the $group stage of an aggregation pipeline to perform summation calculations. - -**Parameters** - - * `expression`: The numeric expression to sum. This can be a field path, an expression, or a constant. - - - - -## Example (MongoDB Shell) - -The following example demonstrates the use of the `$sum` operator to calculate the total sales for each product. - -**Create sample documents** - - - db.sales.insertMany([ - { product: "abc", price: 10, quantity: 2 }, - { product: "abc", price: 10, quantity: 3 }, - { product: "xyz", price: 20, quantity: 1 }, - { product: "xyz", price: 20, quantity: 5 } - ]); - -**Query example** - - - db.sales.aggregate([ - { $group: { - _id: "$product", - totalSales: { $sum: { $multiply: [ "$price", "$quantity" ] } } - }} - ]); - -**Output** - - - [ - { "_id": "abc", "totalSales": 50 }, - { "_id": "xyz", "totalSales": 120 } - ] - -## Code examples - -To view a code example for using the `$sum` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function example() { - const uri = 'mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'; - const client = new MongoClient(uri); - - try { - await client.connect(); - - const db = client.db('test'); - const collection = db.collection('sales'); - - const result = await collection.aggregate([ - { $group: { - _id: "$product", - totalSales: { $sum: { $multiply: [ "$price", "$quantity" ] } } - }} - ]).toArray(); - - console.log(result); - - } catch (error) { - console.error('Error:', error); - } finally { - await client.close(); - } - } - - example(); - -Python - - - - from pymongo import MongoClient - from pprint import pprint - - def example(): - client = None - try: - 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.sales - - result = list(collection.aggregate([ - { '$group': { - '_id': '$product', - 'totalSales': { '$sum': { '$multiply': [ '$price', '$quantity' ] } } - }} - ])) - - pprint(result) - - except Exception as e: - print(f"An error occurred: {e}") - - finally: - if client: - 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) - -$subtract - -$switch - -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.