[DOCS-6636] Comment on: "manual/reference/method/db.collection.count.txt" Created: 23/Nov/15  Updated: 03/Nov/17  Resolved: 23/Nov/15

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: https://docs.mongodb.org/manual/reference/method/db.collection.count/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Referrer: https://www.google.com.kh
Screen Resolution: 1366 x 768
repo: docs
source: reference/method/db.collection.count


Participants:
Days since reply: 8 years, 12 weeks, 3 days ago

 Description   

what i want from this document is how to count array not count object. Thanks.



 Comments   
Comment by Kay Kim (Inactive) [ 23/Nov/15 ]

We have the $size operator in the aggregation framework to count elements in an array. https://docs.mongodb.org/master/reference/operator/aggregation/size/

The db.collection.count() page counts the number of documents in the array, as the page states.

Generated at Thu Feb 08 07:52:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.