AWS documentdb documentation change
Summary
Entire documentation page for the $multiply operator in Amazon DocumentDB has been removed, including all examples and code snippets.
Security assessment
The change removes general documentation about the $multiply operator and its usage examples. There is no evidence in the diff of addressing a security vulnerability, weakness, or incident. This appears to be routine documentation cleanup or restructuring without any security context.
Diff
diff --git a/documentdb/latest/developerguide/multiply.md b/documentdb/latest/developerguide/multiply.md index 77c0d5611..8b1378917 100644 --- a//documentdb/latest/developerguide/multiply.md +++ b//documentdb/latest/developerguide/multiply.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#multiply "Open PDF") @@ -3,152 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $multiply - -The `$multiply` operator in Amazon DocumentDB is used to multiply the values of two or more fields or expressions. This operator is particularly useful for performing arithmetic operations on numeric fields within documents. It can be employed in various stages of the aggregation pipeline, such as `$project` and `$addFields`, to create new fields or modify existing ones. - -**Parameters** - - * `expression1`: The first numeric expression to be multiplied. - - * `expression2`: The second numeric expression to be multiplied. - - * `[expression3, ...]`: (optional) Additional numeric expressions to be multiplied. - - - - -## Example (MongoDB Shell) - -The following example demonstrates using `$multiply` to calculate `bonus_miles` by multiplying `base_miles` and `bonus_rate` for customers who used a credit card for the trip. - -**Sample documents** - - - db.miles.insertMany([ - { "_id": 1, "customer_name": "Arnav Desai", "member_since": ISODate("1997-03-01T00:00:00Z"), "base_miles": 2500, "bonus_rate": 1.8, "credit_card": true, "trip_cost": 250 }, - { "_id": 2, "customer_name": "Jorge Souza", "member_since": ISODate("2004-01-10T00:00:00Z"), "base_miles": 1890, "bonus_rate": 1.4, "credit_card": true, "trip_cost": 189 }, - { "_id": 3, "customer_name": "Saanvi Sarkar", "member_since": ISODate("1999-11-22T00:00:00Z"), "base_miles": 3250, "bonus_rate": 1.8, "credit_card": false, "trip_cost": 325 }, - { "_id": 4, "customer_name": "Paulo Santos", "member_since": ISODate("2021-06-19T00:00:00Z"), "base_miles": 2980, "bonus_rate": 1.2, "credit_card": true, "trip_cost": 298 }, - { "_id": 5, "customer_name": "Wang Xiulan", "member_since": ISODate("1995-12-04T00:00:00Z"), "base_miles": 1350, "bonus_rate": 1.9, "credit_card": false, "trip_cost": 135 } - ]); - - -**Query example** - - - db.miles.aggregate([ - { - $match: { credit_card: true } - }, - { - $project: { - customer_name: 1, - base_miles: 1, - bonus_rate:1, - credit_card: 1, - total_miles: { - $multiply: ["$base_miles", "$bonus_rate"] - } - } - } - ]); - -**Output** - - - [ - { _id: 1, customer_name: 'Arnav Desai', base_miles: 12500, bonus_rate: 1.8, credit_card: true, total_miles: 22500 }, - { _id: 3, customer_name: 'Saanvi Sarkar',base_miles: 15200, bonus_rate: 1.8, credit_card: true, total_miles: 27360 }, - { _id: 4, customer_name: 'Paulo Santos', base_miles: 3400, bonus_rate: 1.1, credit_card: true, total_miles: 3740 } - ] - -## Code examples - -To view a code example for using the `$multiply` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function multiplyBonusMiles() { - 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('miles'); - - const result = await collection.aggregate([ - { $match: { credit_card: true } }, - { - $project: { - customer_name: 1, - base_miles: 1, - bonus_rate: 1, - credit_card: 1, - total_miles: { - $multiply: ["$base_miles", "$bonus_rate"] - } - } - } - ]).toArray(); - - console.log(result); - await client.close(); - } - - multiplyBonusMiles(); - -Python - - - - from pymongo import MongoClient - - def multiply_bonus_miles(): - 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['miles'] - - result = list(collection.aggregate([ - {'$match': {'credit_card': True}}, - { - '$project': { - 'customer_name': 1, - 'base_miles': 1, - 'bonus_rate': 1, - 'credit_card': 1, - 'total_miles': { - '$multiply': ['$base_miles', '$bonus_rate'] - } - } - } - ])) - - print(result) - client.close() - - multiply_bonus_miles() - - **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) - -$month - -$natural - -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.