AWS documentdb documentation change
Summary
Added new documentation page for the $isoDayOfWeek operator in Amazon DocumentDB, including detailed explanation, parameters, MongoDB shell example, and code examples in Node.js and Python
Security assessment
This change adds documentation for a new operator ($isoDayOfWeek) in Amazon DocumentDB. The content includes standard documentation elements like operator description, parameters, examples, and code samples. There is no mention of security vulnerabilities, patches, or security-related features. The code examples show standard connection strings with TLS enabled (tls=true) which is a security best practice, but this is not the primary focus of the documentation addition.
Diff
diff --git a/documentdb/latest/developerguide/isoDayOfWeek.md b/documentdb/latest/developerguide/isoDayOfWeek.md index 8b1378917..4847c0204 100644 --- a//documentdb/latest/developerguide/isoDayOfWeek.md +++ b//documentdb/latest/developerguide/isoDayOfWeek.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#isoDayOfWeek "Open PDF") @@ -1,0 +3,134 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $isoDayOfWeek + +The `$isoDayOfWeek` operator in Amazon DocumentDB returns the ISO day of the week for a date as an integer value. The ISO week date system defines each week starting on a Monday and ending on a Sunday, with week 1 being the week that contains the year's first Thursday. + +**Parameters** + + * `expression`: The date expression for which to return the ISO day of the week. + + + + +## Example (MongoDB Shell) + +The following example demonstrates how to use the `$isoDayOfWeek` operator to retrieve the ISO day of the week for a set of event documents. + +**Create sample documents** + + + db.events.insertMany([ + { _id: 1, eventDate: ISODate("2023-04-01T12:00:00Z") }, + { _id: 2, eventDate: ISODate("2023-04-02T12:00:00Z") }, + { _id: 3, eventDate: ISODate("2023-04-03T12:00:00Z") }, + { _id: 4, eventDate: ISODate("2023-04-04T12:00:00Z") }, + { _id: 5, eventDate: ISODate("2023-04-05T12:00:00Z") }, + { _id: 6, eventDate: ISODate("2023-04-06T12:00:00Z") }, + { _id: 7, eventDate: ISODate("2023-04-07T12:00:00Z") } + ]); + +**Query example** + + + db.events.aggregate([ + { $project: { + _id: 1, + eventDate: 1, + isoDayOfWeek: { $isoDayOfWeek: "$eventDate" } + }} + ]); + +**Output** + + + [ + { "_id": 1, "eventDate": ISODate("2023-04-01T12:00:00Z"), "isoDayOfWeek": 6 }, + { "_id": 2, "eventDate": ISODate("2023-04-02T12:00:00Z"), "isoDayOfWeek": 7 }, + { "_id": 3, "eventDate": ISODate("2023-04-03T12:00:00Z"), "isoDayOfWeek": 1 }, + { "_id": 4, "eventDate": ISODate("2023-04-04T12:00:00Z"), "isoDayOfWeek": 2 }, + { "_id": 5, "eventDate": ISODate("2023-04-05T12:00:00Z"), "isoDayOfWeek": 3 }, + { "_id": 6, "eventDate": ISODate("2023-04-06T12:00:00Z"), "isoDayOfWeek": 4 }, + { "_id": 7, "eventDate": ISODate("2023-04-07T12:00:00Z"), "isoDayOfWeek": 5 } + ] + +## Code examples + +To view a code example for using the `$isoDayOfWeek` 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 events = db.collection('events'); + + const result = await events.aggregate([ + { + $project: { + _id: 1, + eventDate: 1, + isoDayOfWeek: { $isoDayOfWeek: '$eventDate' } + } + } + ]).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 + events = db.events + + result = list(events.aggregate([ + { + '$project': { + '_id': 1, + 'eventDate': 1, + 'isoDayOfWeek': { '$isoDayOfWeek': '$eventDate' } + } + } + ])) + + 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) + +$isArray + +$isoWeek + +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.