AWS documentdb documentation change
Summary
Entire documentation page for the $sort update modifier has been removed, including all examples, code samples, and explanatory content.
Security assessment
The change removes an entire documentation page without any indication of security vulnerability remediation. The removed content was purely functional documentation about the $sort operator usage with $push in MongoDB operations. There is no mention of security flaws, vulnerabilities, or incident response in the diff. The removal appears to be a routine documentation cleanup or restructuring.
Diff
diff --git a/documentdb/latest/developerguide/sort-update.md b/documentdb/latest/developerguide/sort-update.md index 8ca206965..8b1378917 100644 --- a//documentdb/latest/developerguide/sort-update.md +++ b//documentdb/latest/developerguide/sort-update.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#sort-update "Open PDF") @@ -3,147 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $sort - -The `$sort` update modifier orders array elements when used with the `$push` operator. It arranges array elements in ascending or descending order based on specified field values or the elements themselves. - -**Parameters** - - * `field`: The array field to modify. - - * `order`: Use `1` for ascending order or `-1` for descending order. - - - - -## Example (MongoDB Shell) - -The following example demonstrates using the `$sort` modifier with `$push` to add new quiz scores and keep them sorted in descending order. - -**Create sample documents** - - - db.students.insertOne({ - _id: 1, - name: "Bob", - quizzes: [ - { score: 85, date: "2024-01-15" }, - { score: 92, date: "2024-02-10" } - ] - }); - -**Query example** - - - db.students.updateOne( - { _id: 1 }, - { - $push: { - quizzes: { - $each: [{ score: 78, date: "2024-03-05" }], - $sort: { score: -1 } - } - } - } - ) - -**Output** - - - { - "_id" : 1, - "name" : "Bob", - "quizzes" : [ - { "score" : 92, "date" : "2024-02-10" }, - { "score" : 85, "date" : "2024-01-15" }, - { "score" : 78, "date" : "2024-03-05" } - ] - } - -## Code examples - -To view a code example for using the `$sort` update modifier, 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: { - quizzes: { - $each: [{ score: 78, date: "2024-03-05" }], - $sort: { score: -1 } - } - } - } - ); - - 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': { - 'quizzes': { - '$each': [{'score': 78, 'date': '2024-03-05'}], - '$sort': {'score': -1} - } - } - } - ) - - 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) - -$slice - -$unset - -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.