AWS documentdb documentation change
Summary
Removed entire documentation for the $map operator in Amazon DocumentDB, including examples in MongoDB Shell, Node.js, and Python.
Security assessment
The change completely deletes documentation content without any mention of security vulnerabilities, weaknesses, or incidents. This appears to be a routine documentation removal or restructuring, possibly moving content to another location. There is no evidence in the diff that this change addresses a security issue or adds security-related documentation.
Diff
diff --git a/documentdb/latest/developerguide/map.md b/documentdb/latest/developerguide/map.md index 31a6b1db7..8b1378917 100644 --- a//documentdb/latest/developerguide/map.md +++ b//documentdb/latest/developerguide/map.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#map "Open PDF") @@ -3,124 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $map - -The `$map` operator in Amazon DocumentDB allows you to apply a specified expression to each element in an array and return a new array with the transformed elements. This operator is particularly useful for manipulating and transforming data within arrays, which can help simplify your application code and improve query performance by pushing the array processing to the database level. - -**Parameters** - - * `input`: The array to be transformed. - - * `as`: (optional) The name of the variable to be used within the in expression to represent the current element being processed. - - * `in`: The expression to be applied to each element in the input array. - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the $map operator to transform an array of numbers, doubling each value. - -**Create sample documents** - - - db.collection.insertMany([ - { _id: 1, numbers: [1, 2, 3, 4, 5] }, - { _id: 2, numbers: [10, 20, 30, 40, 50] } - ]) - -**Query example** - - - db.collection.aggregate([ - { - $project: { - doubledNumbers: { $map: { input: "$numbers", as: "num", in: { $multiply: ["$$num", 2] } } } - } - } - ]) - -**Output** - - - [ - { _id: 1, doubledNumbers: [2, 4, 6, 8, 10] }, - { _id: 2, doubledNumbers: [20, 40, 60, 80, 100] } - ] - -## Code examples - -To view a code example for using the `$map` 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('collection'); - - const result = await collection.aggregate([ - { - $project: { - doubledNumbers: { $map: { input: "$numbers", as: "num", in: { $multiply: ["$$num", 2] } } } - } - } - ]).toArray(); - - console.log(result); - await 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.collection - - result = list(collection.aggregate([ - { - '$project': { - 'doubledNumbers': { '$map': { 'input': '$numbers', 'as': 'num', 'in': { '$multiply': ['$$num', 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) - -$ltrim - -$match - -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.