AWS documentdb documentation change
Summary
Entire documentation page for the $substr operator in Amazon DocumentDB has been removed, including all examples and code samples
Security assessment
This change removes documentation for a specific operator ($substr) but does not contain any evidence of addressing a security vulnerability, weakness, or incident. The removal appears to be part of documentation reorganization or deprecation of content, not security-related. No security implications are evident from the removal of this operator documentation.
Diff
diff --git a/documentdb/latest/developerguide/substr.md b/documentdb/latest/developerguide/substr.md index d984b07b8..8b1378917 100644 --- a//documentdb/latest/developerguide/substr.md +++ b//documentdb/latest/developerguide/substr.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#substr "Open PDF") @@ -3,126 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $substr - -The `$substr` operator in Amazon DocumentDB is used to extract a substring from a given string. It is particularly useful when you need to define substrings based on a range of characters, rather than a range of bytes. This is especially important when dealing with Unicode strings, where the number of bytes used to represent a character can vary. - -**Parameters** - - * `string`: The input string from which to extract the substring. - - * `start`: The starting position (zero-based) of the substring to be extracted. Can be a non-negative integer expression. - - * `length`: The number of characters in the extracted substring. Can be a non-negative integer expression. - - - - -## Example (MongoDB Shell) - -In this example, we'll demonstrate the use of `$substr` to extract the state abbreviation from an employee's desk location. - -**Create sample documents** - - - db.people.insertMany([ - { "_id": 1, "Desk": "Düsseldorf-NRW-021" }, - { "_id": 2, "Desk": "Bremerhaven-HBB-32a" }, - { "_id": 3, "Desk": "Norderstedt-SHH-892.50" }, - { "_id": 4, "Desk": "Brandenburg-BBB-78" } - ]); - -**Query example** - - - db.people.aggregate([ - { - $project: { - "state": { $substr: ["$Desk", 12, 3] } - } - } - ]) - -**Output** - - - { "_id": 1, "state": "NRW" }, - { "_id": 2, "state": "HBB" }, - { "_id": 3, "state": "SHH" }, - { "_id": 4, "state": "BBB" } - -## Code examples - -To view a code example for using the `$substr` 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: { - "state": { $substrCP: ["$Desk", 12, 3] } - } - } - ]).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": { - "state": { "$substrCP": ["$Desk", 12, 3] } - } - } - ])) - - 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) - -$strcasecmp - -$substrBytes - -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.