FindOptions class

Constructors

FindOptions({int? batchSize, bool singleBatch = false, String? comment, int? maxTimeMS, ReadConcern? readConcern, Map<String, Object>? max, Map<String, Object>? min, bool returnKey = false, bool showRecordId = false, bool tailable = false, bool oplogReplay = false, bool noCursorTimeout = false, bool awaitData = false, bool allowPartialResult = false, CollationOptions? collation, bool allowDiskUse = false})

Properties

allowDiskUse bool
Use allowDiskUse to allow MongoDB to use temporary files on disk to store data exceeding the 100 megabyte memory limit while processing a non-indexed (“blocking”) sort operation. If MongoDB requires using more than 100 megabytes of memory for a blocking sort operation, MongoDB returns an error unless the query specifies allowDiskUse. See Sort and Index Use for more information on blocking sort operations. allowDiskUse has no effect if MongoDB can satisfy the specified sort using an index, or if the blocking sort requires less than 100 megabytes of memory. For more complete documentation on allowDiskUse, see cursor.allowDiskUse(). For more information on memory restrictions for large blocking sorts, see Sort and Index Use. @Since(4.4)
final
allowPartialResult bool
For queries against a sharded collection, allows the command (or subsequent getMore commands) to return partial results, rather than an error, if one or more queried shards are unavailable. Starting in MongoDB 4.4, if find (or subsequent getMore commands) returns partial results due to the unavailability of the queried shard(s), the output includes a partialResultsReturned indicator field. If the queried shards are initially available for the find command but one or more shards become unavailable in subsequent getMore commands, only the getMore commands run when a queried shard or shards are unavailable include the partialResultsReturned flag in the output.
final
awaitData bool
Use in conjunction with the tailable option to block a getMore command on the cursor temporarily if at the end of data rather than returning no data. After a timeout period, find returns as normal.
final
batchSize int?
The number of documents to return in the first batch. Defaults to 101. A batchSize of 0 means that the cursor will be established, but no documents will be returned in the first batch. Unlike the previous wire protocol version, a batchSize of 1 for the find command does not close the cursor
final
collation CollationOptions?
Specifies the collation to use for the operation. Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks. See Collation document @Since(3.4)
final
comment String?
A user-provided comment to attach to this command. Once set, this comment appears alongside records of this command in the following locations:
final
hashCode int
The hash code for this object.
no setterinherited
max Map<String, Object>?
The exclusive upper bound for a specific index. See cursor.max() for details. Starting in MongoDB 4.2, to use the max field, the command must also use hint unless the specified filter is an equality condition on the _id field { _id:
final
maxTimeMS int?
The cumulative time limit in milliseconds for processing operations on the cursor. MongoDB aborts the operation at the earliest following interrupt point. Tip When specifying linearizable read concern, always use maxTimeMS in case a majority of data bearing members are unavailable. maxTimeMS ensures that the operation does not block indefinitely and instead ensures that the operation returns an error if the read concern cannot be fulfilled.
final
min Map<String, Object>?
The inclusive lower bound for a specific index. See cursor.min() for details. Starting in MongoDB 4.2, to use the min field, the command must also use hint unless the specified filter is an equality condition on the _id field { _id:
final
noCursorTimeout bool
Prevents the server from timing out idle cursors after an inactivity period (10 minutes).
final
oplogReplay bool
An internal command for replaying a replica set’s oplog.
final
options Map<String, Object>
no setter
readConcern → ReadConcern?
Starting in MongoDB 3.6, the readConcern option has the following syntax: readConcern: { level:
final
returnKey bool
If true, returns only the index keys in the resulting documents. Default value is false. If returnKey is true and the find command does not use an index, the returned documents will be empty.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showRecordId bool
Determines whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
final
singleBatch bool
Determines whether to close the cursor after the first batch. Defaults to false.
final
tailable bool
Returns a tailable cursor for a capped collections
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited