AWS documentdb documentation change
Summary
Entire documentation file for the $dateDiff aggregation operator has been removed, including all examples, syntax, and code samples
Security assessment
This change appears to be a routine documentation removal or restructuring. There is no evidence of security vulnerability, incident response, or security-related content in the removed material. The removed content was purely functional documentation about a date calculation operator with no security implications mentioned.
Diff
diff --git a/documentdb/latest/developerguide/dateDiff.md b/documentdb/latest/developerguide/dateDiff.md index 051194210..8b1378917 100644 --- a//documentdb/latest/developerguide/dateDiff.md +++ b//documentdb/latest/developerguide/dateDiff.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#dateDiff "Open PDF") @@ -3,175 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $dateDiff - -New from version 5.0 - -Not supported by Elastic cluster. - -The `$dateDiff` aggregation operator calculates the difference between two dates in specified units. It returns the number of unit boundaries crossed between the start and end dates. - -**Parameters** - - * `startDate`: The beginning date expression. - - * `endDate`: The ending date expression. - - * `unit`: The time unit for the difference. Supported units are `year`, `quarter`, `month`, `week`, `day`, `hour`, `minute`, `second`, and `millisecond`. - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the `$dateDiff` operator to calculate the number of days between order placement and delivery. - -**Create sample documents** - - - db.shipments.insertMany([ - { - orderId: 1001, - orderDate: ISODate("2025-01-10T08:00:00Z"), - deliveryDate: ISODate("2025-01-15T14:30:00Z") - }, - { - orderId: 1002, - orderDate: ISODate("2025-02-05T10:00:00Z"), - deliveryDate: ISODate("2025-02-12T16:45:00Z") - } - ]); - -**Query example** - - - db.shipments.aggregate([ - { - $project: { - orderId: 1, - orderDate: 1, - deliveryDate: 1, - daysToDeliver: { - $dateDiff: { - startDate: "$orderDate", - endDate: "$deliveryDate", - unit: "day" - } - } - } - } - ]); - -**Output** - - - [ - { - _id: ObjectId('6924a5f2d66dcae121d29517'), - orderId: 1001, - orderDate: ISODate('2025-01-10T08:00:00.000Z'), - deliveryDate: ISODate('2025-01-15T14:30:00.000Z'), - daysToDeliver: 5 - }, - { - _id: ObjectId('6924a5f2d66dcae121d29518'), - orderId: 1002, - orderDate: ISODate('2025-02-05T10:00:00.000Z'), - deliveryDate: ISODate('2025-02-12T16:45:00.000Z'), - daysToDeliver: 7 - } - ] - -## Code examples - -To view a code example for using the `$dateDiff` 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 shipments = db.collection('shipments'); - - const result = await shipments.aggregate([ - { - $project: { - orderId: 1, - orderDate: 1, - deliveryDate: 1, - daysToDeliver: { - $dateDiff: { - startDate: "$orderDate", - endDate: "$deliveryDate", - unit: "day" - } - } - } - } - ]).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'] - shipments = db['shipments'] - - result = list(shipments.aggregate([ - { - "$project": { - "orderId": 1, - "orderDate": 1, - "deliveryDate": 1, - "daysToDeliver": { - "$dateDiff": { - "startDate": "$orderDate", - "endDate": "$deliveryDate", - "unit": "day" - } - } - } - } - ])) - - 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) - -$dateAdd - -$dateFromString - -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.