AWS documentdb documentation change
Summary
Added new documentation page for the $in query operator in Amazon DocumentDB, including syntax, parameters, MongoDB shell example, code examples in Node.js and Python with TLS connections, and notes about limitations with dollar-prefixed field names
Security assessment
This is routine documentation for a query operator without evidence of addressing specific security vulnerabilities. However, it includes security documentation by providing TLS-enabled connection examples with encryption parameters (tls=true, tlsCAFile). The documentation also references functional limitations with dollar-prefixed fields but this is not security-related. The code examples demonstrate secure connection practices.
Diff
diff --git a/documentdb/latest/developerguide/in.md b/documentdb/latest/developerguide/in.md index 8b1378917..52b53bf19 100644 --- a//documentdb/latest/developerguide/in.md +++ b//documentdb/latest/developerguide/in.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#in "Open PDF") @@ -1,0 +3,110 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $in + +The `$in` operator in Amazon DocumentDB is a logical query operator that allows you to find documents where the value of a field equals any of the values specified in an array. + +**Parameters** + + * `field`: The field to check against the provided array. + + * `[value1, value2, ...]`: An array of values to match against the specified field. + + + + +**Dollar (`$`) in field names** + +See [Dollar($) and dot(.) in field names](./functional-differences.html#functional-differences-dollardot) for limitations regarding querying `$` prefixed fields in `$in` in nested objects. + +## Example (MongoDB Shell) + +The following example demonstrates how to use the `$in` operator to find documents where the `color` field is one of the values in the provided array. + +**Create sample documents** + + + db.colors.insertMany([ + { "_id": 1, "color": "red" }, + { "_id": 2, "color": "green" }, + { "_id": 3, "color": "blue" }, + { "_id": 4, "color": "yellow" }, + { "_id": 5, "color": "purple" } + ]) + +**Query example** + + + db.colors.find({ "color": { "$in": ["red", "blue", "purple"] } }) + +**Output** + + + { "_id": 1, "color": "red" }, + { "_id": 3, "color": "blue" }, + { "_id": 5, "color": "purple" } + +## Code examples + +To view a code example for using the `$in` command, choose the tab for the language that you want to use: + +Node.js + + + + const { MongoClient } = require('mongodb'); + + async function findByIn() { + 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('colors'); + + const result = await collection.find({ "color": { "$in": ["red", "blue", "purple"] } }).toArray(); + console.log(result); + + await client.close(); + } + + findByIn(); + +Python + + + + from pymongo import MongoClient + + def find_by_in(): + 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.colors + + result = list(collection.find({ "color": { "$in": ["red", "blue", "purple"] } })) + print(result) + + client.close() + + find_by_in() + + **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) + +$gte + +$jsonSchema + +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.