简体   繁体   中英

How do you use $count?

The mongodb documentation said to use db.collection.aggregate([{$count: "timers"}]) to count how many documents are in the collection "timers", but it says that $count is invalid syntax. Is there a way to fix?

Wrap in quotes "$count"

db.collection.aggregate([{ "$count" : "timers"}])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM