AWS documentdb documentation change
Summary
Added comprehensive documentation for the $not operator in Amazon DocumentDB, including syntax, parameters, MongoDB shell examples, and code examples in Node.js and Python with connection strings
Security assessment
The change adds documentation for a query operator ($not) with no evidence of addressing a specific security vulnerability. However, the code examples include security-relevant configuration: TLS encryption (tls=true) and CA certificate validation (tlsCAFile=global-bundle.pem) in connection strings, which demonstrates secure connection practices. The documentation also mentions index support improvements in planner version 2.0, which is a performance enhancement rather than a security fix.
Diff
diff --git a/documentdb/latest/developerguide/not.md b/documentdb/latest/developerguide/not.md index 8b1378917..c5b48f042 100644 --- a//documentdb/latest/developerguide/not.md +++ b//documentdb/latest/developerguide/not.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#not "Open PDF") @@ -1,0 +3,119 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $not + +The `$not` operator is used to negate the result of a given expression. It allows you to select documents where the specified condition does not match. + +Planner version 2.0 added index support for `$not {eq}` and `$not {in}`. + +**Parameters** + + * `expression`: The expression to negate. + + + + +## Example (MongoDB Shell) + +The following example demonstrates how to use the `$not` operator to find documents where the `status` field is not equal to "active". + +**Create sample documents** + + + db.users.insertMany([ + { name: "John", status: "active" }, + { name: "Jane", status: "inactive" }, + { name: "Bob", status: "pending" }, + { name: "Alice", status: "active" } + ]); + +**Query example** + + + db.users.find({ status: { $not: { $eq: "active" } } }); + +**Output** + + + [ + { + _id: ObjectId('...'), + name: 'Jane', + status: 'inactive' + }, + { + _id: ObjectId('...'), + name: 'Bob', + status: 'pending' + } + ] + +## Code examples + +To view a code example for using the `$not` command, choose the tab for the language that you want to use: + +Node.js + + + + const { MongoClient, Filters } = require('mongodb'); + + async function main() { + 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('users'); + + const result = await collection.find({ + status: { $not: { $eq: "active" } } + }).toArray(); + + console.log(result); + + await client.close(); + } + + main(); + +Python + + + + from pymongo import MongoClient + from bson.son import SON + + 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['users'] + + result = collection.find({ + "status": {"$not": {"$eq": "active"}} + }) + + for doc in result: + print(doc) + + client.close() + + **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) + +$nor + +$or + +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.