cursor.tryNext()
On this page本页内容
cursor.tryNext()
- 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.
Returns:返回值:The next document in the cursor returned by thedb.collection.find()
method ornull
.db.collection.find()
方法返回的游标中的下一个文档或null
。
Behavior行为
cursor.tryNext()
is a special case of the 是cursor.next()
method that returns the next element in the iteration if available or else null
.cursor.next()
方法的特殊情况,如果可用,则返回迭代中的下一个元素,否则返回null
。