AWS documentdb documentation change
Summary
Entire documentation page for the $count aggregation stage has been removed, including examples and code samples
Security assessment
This change removes documentation content entirely but shows no evidence of addressing a security vulnerability. The removed content appears to be standard documentation for the $count operator with example code. There are no security warnings, vulnerability disclosures, or security-related content being added or modified.
Diff
diff --git a/documentdb/latest/developerguide/count.md b/documentdb/latest/developerguide/count.md index 035515ac3..8b1378917 100644 --- a//documentdb/latest/developerguide/count.md +++ b//documentdb/latest/developerguide/count.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#count "Open PDF") @@ -3,111 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $count - -The `$count` aggregation stage in Amazon DocumentDB is used to count the number of documents that pass into the stage. It is often used as the final stage in an aggregation pipeline to return the total count of documents matching the previous stages. - -**Parameters** - - * `field`: The field to count. This parameter is optional, and if not provided, the stage will count the total number of input documents. - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the `$count` stage to get the total number of documents in a collection. - -**Create sample documents** - - - db.users.insertMany([ - { name: "John", age: 30 }, - { name: "Jane", age: 25 }, - { name: "Bob", age: 35 }, - { name: "Alice", age: 28 } - ]); - -**Query example** - - - db.users.aggregate([ - { $count: "total" } - ]); - -**Output** - - - { "total" : 4 } - -The example aggregates the `users` collection and uses the `$count` stage to count the total number of documents. - -## Code examples - -To view a code example for using the `$count` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function countDocuments() { - 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('mydb'); - const collection = db.collection('users'); - - const result = await collection.aggregate([ - { $count: "total" } - ]).toArray(); - - console.log(result[0].total); - - await client.close(); - } - - countDocuments(); - -Python - - - - from pymongo import MongoClient - - def count_documents(): - client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false') - db = client['mydb'] - collection = db['users'] - - result = list(collection.aggregate([ - { '$count': "total" } - ])) - - print(result[0]['total']) - - client.close() - - count_documents() - - **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) - -$convert - -$currentOp - -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.