cursor.allowPartialResults()

On this page本页内容

Definition定义

cursor.allowPartialResults()
Important重要
mongosh Method

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.

When used with db.collection.find() operations against a sharded collection, returns partial results, rather than an error, if one or more queried shards are unavailable.当与针对分片集合的db.collection.find()操作一起使用时,如果一个或多个查询的分片不可用,则返回部分结果,而不是错误。

Syntax语法

The cursor.allowPartialResults() method has the following syntax:cursor.allowPartialResults()方法具有以下语法:

db.collection.find(<query>, <projection>).allowPartialResults()
←  cursor.allowDiskUse()cursor.batchSize() →