AWS documentdb documentation change
Summary
Removed entire documentation page for the $ positional operator (including examples and code samples)
Security assessment
This change removes documentation about a MongoDB operator feature. There is no evidence in the diff that this removal is related to a security vulnerability, weakness, or incident. The removed content appears to be standard operational documentation without security implications.
Diff
diff --git a/documentdb/latest/developerguide/dollar-update.md b/documentdb/latest/developerguide/dollar-update.md index 98a5a907e..8b1378917 100644 --- a//documentdb/latest/developerguide/dollar-update.md +++ b//documentdb/latest/developerguide/dollar-update.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#dollar-update "Open PDF") @@ -3,116 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $ - -The `$` positional operator updates the first array element that matches the query condition. It acts as a placeholder for the matched array element's position. - -**Parameters** - - * `field.$`: The array field with the positional operator to update the first matching element. - - - - -## Example (MongoDB Shell) - -The following example demonstrates using the `$` positional operator to update a specific array element. - -**Create sample documents** - - - db.inventory.insertMany([ - { _id: 1, item: "Widget", quantities: [10, 20, 30] }, - { _id: 2, item: "Gadget", quantities: [5, 15, 25] } - ]); - -**Query example** - - - db.inventory.updateOne( - { _id: 1, quantities: 20 }, - { $set: { "quantities.$": 22 } } - ); - -**Output** - - - { - "_id" : 1, - "item" : "Widget", - "quantities" : [ 10, 22, 30 ] - } - -## Code examples - -To view a code example for using the `$` positional operator, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function updateDocument() { - 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('inventory'); - - await collection.updateOne( - { _id: 1, quantities: 20 }, - { $set: { "quantities.$": 22 } } - ); - - const updatedDocument = await collection.findOne({ _id: 1 }); - console.log(updatedDocument); - - await client.close(); - } - - updateDocument(); - -Python - - - - from pymongo import MongoClient - - def update_document(): - 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.inventory - - collection.update_one( - {'_id': 1, 'quantities': 20}, - {'$set': {'quantities.$': 22}} - ) - - updated_document = collection.find_one({'_id': 1}) - print(updated_document) - - client.close() - - update_document() - - **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) - -Update operators - -$[] - -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.