AWS documentdb documentation change
Summary
Entire documentation page for the $last operator in Amazon DocumentDB has been removed, including all examples and code samples
Security assessment
This change removes documentation about a specific MongoDB operator ($last) and its usage examples. 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 any security warnings or security-related context. The change could potentially impact security if the operator had security implications that are no longer documented, but there is no concrete evidence of this in the diff.
Diff
diff --git a/documentdb/latest/developerguide/last.md b/documentdb/latest/developerguide/last.md index 34ef628d0..8b1378917 100644 --- a//documentdb/latest/developerguide/last.md +++ b//documentdb/latest/developerguide/last.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#last "Open PDF") @@ -3,184 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $last - -The `$last` operator in Amazon DocumentDB is used to return the last element in an array that matches the query criteria. It is particularly useful for retrieving the most recent or the last element in an array that satisfies a specific condition. - -**Parameters** - - * `expression`: The expression to match the array elements. - - - - -## Example (MongoDB Shell) - -The following example demonstrates the use of the `$last` operator in combination with `$filter` to retrieve the last element from an array that meets a specific condition (e.g., subject is 'science'). - -**Create sample documents** - - - db.collection.insertMany([ - { - "_id": 1, - "name": "John", - "scores": [ - { "subject": "math", "score": 82 }, - { "subject": "english", "score": 85 }, - { "subject": "science", "score": 90 } - ] - }, - { - "_id": 2, - "name": "Jane", - "scores": [ - { "subject": "math", "score": 92 }, - { "subject": "english", "score": 88 }, - { "subject": "science", "score": 87 } - ] - }, - { - "_id": 3, - "name": "Bob", - "scores": [ - { "subject": "math", "score": 75 }, - { "subject": "english", "score": 80 }, - { "subject": "science", "score": 85 } - ] - } - ]); - -**Query example** - - - db.collection.aggregate([ - { $match: { name: "John" } }, - { - $project: { - name: 1, - lastScienceScore: { - $last: { - $filter: { - input: "$scores", - as: "score", - cond: { $eq: ["$$score.subject", "science"] } - } - } - } - } - } - ]); - -**Output** - - - [ - { - _id: 1, - name: 'John', - lastScienceScore: { subject: 'science', score: 90 } - } - ] - -## Code examples - -To view a code example for using the `$last` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function example() { - 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('collection'); - - const result = await collection.aggregate([ - { $match: { name: "John" } }, - { - $project: { - name: 1, - lastScienceScore: { - $last: { - $filter: { - input: "$scores", - as: "score", - cond: { $eq: ["$$score.subject", "science"] } - } - } - } - } - } - ]).toArray(); - - console.log(JSON.stringify(result, null, 2)); - await client.close(); - } - - example(); - -Python - - - - from pymongo import MongoClient - - def example(): - - 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.collection - - pipeline = [ - { "$match": { "name": "John" } }, - { - "$project": { - "name": 1, - "lastScienceScore": { - "$last": { - "$filter": { - "input": "$scores", - "as": "score", - "cond": { "$eq": ["$$score.subject", "science"] } - } - } - } - } - } - ] - - result = list(collection.aggregate(pipeline)) - - print(result) - - client.close() - - example() - - **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) - -$isoWeekYear - -$let - -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.