Docs HomeMongoDB Manual

cursor.itcount()

On this page本页内容

Definition定义

cursor.itcount()
Important

mongosh Method

This page documents a mongosh method. This is not the documentation for a language-specific driver, such as Node.js.

For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.

Counts the number of documents remaining in a cursor.统计游标中剩余的文档数。

itcount() is similar to cursor.count(), but actually executes the query on an existing iterator, exhausting its contents in the process.类似于cursor.count(),但实际上是在现有迭代器上执行查询,从而在过程中耗尽其内容。

The itcount() method has the following prototype form:itcount()方法具有以下原型形式:

db.collection.find(<query>).itcount()
Tip

See also: 另请参阅:

cursor.count()