简体   繁体   English

你如何使用 $count?

[英]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. mongodb 文档说使用db.collection.aggregate([{$count: "timers"}])来计算集合“计时器”中有多少文档,但它说$count是无效的语法。 Is there a way to fix?有没有办法解决?

Wrap in quotes "$count"用引号括起来"$count"

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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