AWS documentdb documentation change
Summary
Entire documentation page for the $indexOfArray operator was removed, including examples, parameters, and code samples for MongoDB Shell, Node.js, and Python.
Security assessment
This change removes general documentation about the $indexOfArray operator (array search operator) which is a standard MongoDB/Amazon DocumentDB feature. There is no evidence in the diff suggesting this removal addresses a security vulnerability, weakness, or incident. The removed content appears to be routine documentation about database functionality without any security context mentioned.
Diff
diff --git a/documentdb/latest/developerguide/indexOfArray.md b/documentdb/latest/developerguide/indexOfArray.md index 1754e5bcc..8b1378917 100644 --- a//documentdb/latest/developerguide/indexOfArray.md +++ b//documentdb/latest/developerguide/indexOfArray.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#indexOfArray "Open PDF") @@ -3,127 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $indexOfArray - -The `$indexOfArray` operator in Amazon DocumentDB is used to find the index of the first occurrence of a specified element in an array. This operator returns the zero-based index position of the first element in the array that matches the specified value. If the value is not found, it returns -1. - -**Parameters** - - * `array`: The array to search. - - * `value`: The value to search for in the array. - - * `start`: (optional) The position in the array to start the search from. The default value is 0. - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the $indexOfArray operator to find the index of the first occurrence of the element "mango" in the "fruits" array for each document. - -**Create sample documents** - - - db.collection.insertMany([ - { _id: 1, fruits: ["apple", "banana", "cherry", "durian"] }, - { _id: 2, fruits: ["mango", "orange", "pineapple"] }, - { _id: 3, fruits: ["kiwi", "lemon", "mango"] } - ]); - -**Query example** - - - db.collection.aggregate([ - { - $project: { - _id: 1, - fruitIndex: { $indexOfArray: ["$fruits", "mango"] } - } - } - ]); - -**Output** - - - { "_id" : 1, "fruitIndex" : 1 } - { "_id" : 2, "fruitIndex" : 0 } - { "_id" : 3, "fruitIndex" : 2 } - -## Code examples - -To view a code example for using the `$indexOfArray` 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([ - { - $project: { - _id: 1, - fruitIndex: { $indexOfArray: ["$fruits", "mango"] } - } - } - ]).toArray(); - - console.log(result); - 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'] - - result = list(collection.aggregate([ - { - '$project': { - '_id': 1, - 'fruitIndex': { '$indexOfArray': ["$fruits", "mango"] } - } - } - ])) - - 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) - -$in - -$indexOfBytes - -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.