AWS documentdb documentation change
Summary
Entire documentation page for the $objectToArray aggregation operator was removed, including all examples and code samples
Security assessment
This change removes documentation for a specific MongoDB aggregation operator ($objectToArray) but provides no evidence of security vulnerability, patch, or security-related context. The removal appears to be routine documentation cleanup or restructuring rather than addressing a security issue. No security implications are mentioned in the diff.
Diff
diff --git a/documentdb/latest/developerguide/objectToArray.md b/documentdb/latest/developerguide/objectToArray.md index bb628224f..8b1378917 100644 --- a//documentdb/latest/developerguide/objectToArray.md +++ b//documentdb/latest/developerguide/objectToArray.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#objectToArray "Open PDF") @@ -3,207 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $objectToArray - -The `$objectToArray` aggregation operator in Amazon DocumentDB converts an object (or document) into an array. The input to the operator is a document, and the output consists of an array element for each field-value pair in the input document. This operator is useful when you need to work with the individual fields of a document as an array, such as when you want to find the document with the maximum or minimum value for a particular field. - -**Parameters** - - * `expression`: The document expression to convert into an array. - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the `$objectToArray` operator to find the document with the maximum inventory for a video rental store chain. - -**Create sample documents** - - - db.videos.insertMany([ - { - "_id": 1, - "name": "Live Soft", - "inventory": { - "Des Moines": 1000, - "Ames": 500 - } - }, - { - "_id": 2, - "name": "Top Pilot", - "inventory": { - "Mason City": 250, - "Des Moines": 1000 - } - }, - { - "_id": 3, - "name": "Romancing the Rock", - "inventory": { - "Mason City": 250, - "Ames": 500 - } - }, - { - "_id": 4, - "name": "Bravemind", - "inventory": { - "Mason City": 250, - "Des Moines": 1000, - "Ames": 500 - } - } - ]); - -**Query example** - - - db.videos.aggregate([ - { - $project: { - name: 1, - videos: { - $objectToArray: "$inventory" - } - } - }, - { - $unwind: "$videos" - }, - { - $group: { - _id: "$name", - maxInventory: { - $max: "$videos.v" - } - } - } - ]); - -**Output** - - - [ - { - "_id": "Bravemind", - "maxInventory": 1000 - }, - { - "_id": "Live Soft", - "maxInventory": 1000 - }, - { - "_id": "Romancing the Rock", - "maxInventory": 500 - }, - { - "_id": "Top Pilot", - "maxInventory": 1000 - } - ] - -## Code examples - -To view a code example for using the `$objectToArray` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function findMaxInventory() { - 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 videos = db.collection('videos'); - - const result = await videos.aggregate([ - { - $project: { - name: 1, - videos: { - $objectToArray: "$inventory" - } - } - }, - { - $unwind: "$videos" - }, - { - $group: { - _id: "$name", - maxInventory: { - $max: "$videos.v" - } - } - } - ]).toArray(); - - console.log(result); - client.close(); - } - - findMaxInventory(); - -Python - - - - from pymongo import MongoClient - - def find_max_inventory(): - client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false') - db = client['test'] - videos = db['videos'] - - result = list(videos.aggregate([ - { - '$project': { - 'name': 1, - 'videos': { - '$objectToArray': '$inventory' - } - } - }, - { - '$unwind': '$videos' - }, - { - '$group': { - '_id': '$name', - 'maxInventory': { - '$max': '$videos.v' - } - } - } - ])) - - print(result) - client.close() - - find_max_inventory() - - **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) - -$not