On this page本页内容
cursor.itcount()
This is a mongosh
method. This is not the documentation for Node.js
or other programming language specific driver methods.
In most cases, mongosh
methods work the same way as the legacy mongo
shell methods. However, some legacy methods are unavailable in mongosh
.
For the legacy mongo
shell documentation, refer to the documentation for the corresponding MongoDB Server release:
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()