AWS documentdb documentation change
Summary
Removed entire documentation page for the $replaceOne operator in Amazon DocumentDB, including all content, examples, and code samples.
Security assessment
This change completely removes documentation for a specific MongoDB operator ($replaceOne) from the Amazon DocumentDB developer guide. 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 documentation for a string expression operator used in aggregation pipelines, with no security-related content mentioned. The removal could be part of routine documentation cleanup, reorganization, or deprecation of the feature, but without explicit security context, it cannot be classified as security-related.
Diff
diff --git a/documentdb/latest/developerguide/replaceOne.md b/documentdb/latest/developerguide/replaceOne.md index 85514b351..8b1378917 100644 --- a//documentdb/latest/developerguide/replaceOne.md +++ b//documentdb/latest/developerguide/replaceOne.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#replaceOne "Open PDF") @@ -3,174 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $replaceOne - -Introduced in 5.0 - -The `$replaceOne` operator in Amazon DocumentDB is a string expression operator used within aggregation pipelines to replace the first occurrence of a specified substring within a string with a replacement string. This operator is case-sensitive and only replaces the first match found. - -**Parameters** - - * `input`: The string (field) on which to perform the find. - - * `find`: The string to search for within the input. - - * `replacement`: The string to replace the first occurrence of the find in the input(field). - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the `$replaceOne` operator within an aggregation pipeline to replace substrings in product names. - -**Create sample documents** - - - db.products.insertMany([ - { "_id":1, "productId": "PROD-0Y9GL0", "name": "Gordon's Extra Creamy Milk Chocolate - Pack of 4", "category": "Confectionery", "price": 24.99 }, - { "_id":2, "productId": "PROD-Y2E9H5", "name": "Nutrition Co. - Original Corn Flakes Cereal", "category": "Breakfast Cereals", "price": 8.50 }, - { "_id":3, "productId": "PROD-Z3F8K2", "name": "Gordon's Dark Chocolate (90% Cocoa) Pack - Pack of 4", "category": "Confectionery", "price": 28.99 } - ]); - - -**Aggregation example** - - - db.products.aggregate([ - { - $addFields: { - standardizedName: { - $replaceOne: { - input: "$name", - find: "Pack", - replacement: "Package" - } - } - } - } - ]); - -**Output** - -The output shows that only the first occurrence of "Pack" in each product name was replaced with "Package". - - - [ - { - _id: 1, - productId: 'PROD-0Y9GL0', - name: "Gordon's Extra Creamy Milk Chocolate - Pack of 4", - category: 'Confectionery', - price: 24.99, - standardizedName: "Gordon's Extra Creamy Milk Chocolate - Package of 4" - }, - { - _id: 2, - productId: 'PROD-Y2E9H5', - name: 'Nutrition Co. - Original Corn Flakes Cereal', - category: 'Breakfast Cereals', - price: 8.5, - standardizedName: 'Nutrition Co. - Original Corn Flakes Cereal' - }, - { - _id: 3, - productId: 'PROD-Z3F8K2', - name: "Gordon's Dark Chocolate (90% Cocoa) Pack - Pack of 4", - category: 'Confectionery', - price: 28.99, - standardizedName: "Gordon's Dark Chocolate (90% Cocoa) Package - Pack of 4" - } - - -## Code examples - -To view a code example for using the `$replaceOne` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function replaceOne() { - 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('products'); - - const pipeline = [ - { - $addFields: { - standardizedName: { - $replaceOne: { - input: '$name', - find: 'Pack', - replacement: 'Package' - } - } - } - } - ]; - - const result = await collection.aggregate(pipeline).toArray(); - console.log(result); - - await client.close(); - } - - replaceOne(); - -Python - - - - from pymongo import MongoClient - - def replaceOne(): - 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['products'] - - pipeline = [ - { - '$addFields': { - 'standardizedName': { - '$replaceOne': { - 'input': '$name', - 'find': 'Pack', - 'replacement': 'Package' - } - } - } - } - ] - - result = list(collection.aggregate(pipeline)) - print(result) - - client.close() - - replaceOne() - - **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) - -$replaceAll - -$replaceRoot - -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.