AWS documentdb documentation change
Summary
Entire documentation page for the $slice update operator has been removed, including all examples and code samples
Security assessment
This change removes documentation about the $slice operator functionality but provides no evidence of security issues. The removal appears to be a routine documentation cleanup or restructuring, not related to any disclosed vulnerability or security incident. No security warnings or vulnerabilities are mentioned in the removed content.
Diff
diff --git a/documentdb/latest/developerguide/slice-update.md b/documentdb/latest/developerguide/slice-update.md index ff77fb706..8b1378917 100644 --- a//documentdb/latest/developerguide/slice-update.md +++ b//documentdb/latest/developerguide/slice-update.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#slice-update "Open PDF") @@ -3,142 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $slice - -The `$slice` update operator modifies an array by limiting its size. When used with the `$push` operator, it restricts the number of elements in an array, keeping only the specified number of most recent or oldest elements. - -**Parameters** - - * `field`: The array field to modify. - - * `count`: Maximum number of elements to keep. Positive values keep the first N elements, negative values keep the last N elements. - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the `$slice` update operator with `$push` to maintain a fixed-size array of recent scores. - -**Create sample documents** - - - db.students.insertOne({ - _id: 1, - name: "Alice", - scores: [85, 90, 78] - }); - -**Query example** - - - db.students.updateOne( - { _id: 1 }, - { - $push: { - scores: { - $each: [92, 88], - $slice: -3 - } - } - } - ) - -**Output** - - - { - "_id" : 1, - "name" : "Alice", - "scores" : [ 78, 92, 88 ] - } - -In this example, the `$slice: -3` modifier keeps only the last three elements after pushing new values to the array. - -## Code examples - -To view a code example for using the `$slice` update 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('students'); - - await collection.updateOne( - { _id: 1 }, - { - $push: { - scores: { - $each: [92, 88], - $slice: -3 - } - } - } - ); - - 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.students - - collection.update_one( - {'_id': 1}, - { - '$push': { - 'scores': { - '$each': [92, 88], - '$slice': -3 - } - } - } - ) - - 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) - -$setOnInsert - -$sort - -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.