AWS Security ChangesHomeSearch

AWS documentdb documentation change

Service: documentdb · 2026-03-31 · Documentation low

File: documentdb/latest/developerguide/strcasecmp.md

Summary

Added new documentation page for the $strcasecmp operator in Amazon DocumentDB, including description, parameters, MongoDB Shell example, and code examples in Node.js and Python

Security assessment

This change adds documentation for a string comparison operator ($strcasecmp) in Amazon DocumentDB. The content describes the operator's functionality and provides usage examples. There is no evidence of addressing a security vulnerability, weakness, or incident. The code examples include standard connection strings with TLS parameters, but this is routine documentation for database operations rather than security-specific guidance.

Diff

diff --git a/documentdb/latest/developerguide/strcasecmp.md b/documentdb/latest/developerguide/strcasecmp.md
index 8b1378917..094f0fd21 100644
--- a//documentdb/latest/developerguide/strcasecmp.md
+++ b//documentdb/latest/developerguide/strcasecmp.md
@@ -0,0 +1 @@
+[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#strcasecmp "Open PDF")
@@ -1,0 +3,129 @@
+[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
+
+Example (MongoDB Shell)Code examples
+
+# $strcasecmp
+
+The `$strcasecmp` operator in Amazon DocumentDB performs a case-insensitive comparison between two strings. It returns an integer value indicating the lexicographic comparison of the two input strings, ignoring case differences.
+
+**Parameters**
+
+  * `string1`: The first string to compare.
+
+  * `string2`: The second string to compare.
+
+
+
+
+## Example (MongoDB Shell)
+
+This example demonstrates how to use the `$strcasecmp` operator to compare desk location strings in a `people` collection, ignoring case differences.
+
+**Create sample documents**
+    
+    
+    db.people.insertMany([
+      { "_id": 1, "Desk": "mke233-wi" },
+      { "_id": 2, "Desk": "MKE233-WI" },
+      { "_id": 3, "Desk": "mke233-wi" }
+    ]);
+
+**Query example**
+    
+    
+    db.people.aggregate([
+      {
+        $project: {
+          item: 1,
+          compare: { $strcasecmp: ["$Desk", "mke233-wi"] }
+        }
+      }
+    ]);
+
+**Output**
+    
+    
+    { "_id" : 1, "compare" : 0 }
+    { "_id" : 2, "compare" : 0 }
+    { "_id" : 3, "compare" : 0 }
+
+The output shows that the comparison between the `"Desk"` field and the string `"mke233-wi"` returns `0` for all three documents, indicating that the strings are equal when case is ignored.
+
+## Code examples
+
+To view a code example for using the `$strcasecmp` 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('people');
+    
+      const result = await collection.aggregate([
+        {
+          $project: {
+            item: 1,
+            compare: { $strcasecmp: ["$Desk", "mke233-wi"] }
+          }
+        }
+      ]).toArray();
+    
+      console.log(result);
+    
+      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.people
+    
+        result = list(collection.aggregate([
+            {
+                '$project': {
+                    'item': 1,
+                    'compare': { '$strcasecmp': ['$Desk', 'mke233-wi'] }
+                }
+            }
+        ]))
+    
+        print(result)
+    
+        client.close()
+    
+    example()
+
+![Warning](https://d1ge0kk1l5kms0.cloudfront.net/images/G/01/webservices/console/warning.png) **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)
+
+$strLenCP
+
+$substr
+
+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.