FindOptions
public struct FindOptions : Encodable
Options to use when executing a find
command on a MongoCollection
.
-
Get partial results from a mongos if some shards are down (instead of throwing an error).
Declaration
Swift
public let allowPartialResults: Bool?
-
The number of documents to return per batch.
Declaration
Swift
public let batchSize: Int32?
-
Specifies a collation.
Declaration
Swift
public let collation: Document?
-
Attaches a comment to the query.
Declaration
Swift
public let comment: String?
-
Indicates the type of cursor to use. This value includes both the tailable and awaitData options.
Declaration
Swift
public let cursorType: CursorType?
-
A hint for the index to use.
Declaration
Swift
public let hint: Hint?
-
The maximum number of documents to return.
Declaration
Swift
public let limit: Int64?
-
The exclusive upper bound for a specific index.
Declaration
Swift
public let max: Document?
-
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies when used with
CursorType.tailableAwait
. Otherwise, this option is ignored.Declaration
Swift
public let maxAwaitTimeMS: Int64?
-
Maximum number of documents or index keys to scan when executing the query.
Declaration
Swift
public let maxScan: Int64?
-
The maximum amount of time to allow the query to run.
Declaration
Swift
public let maxTimeMS: Int64?
-
The inclusive lower bound for a specific index.
Declaration
Swift
public let min: Document?
-
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.
Declaration
Swift
public let noCursorTimeout: Bool?
-
Limits the fields to return for all matching documents.
Declaration
Swift
public let projection: Document?
-
If true, returns only the index keys in the resulting documents.
Declaration
Swift
public let returnKey: Bool?
-
Determines whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
Declaration
Swift
public let showRecordId: Bool?
-
The number of documents to skip before returning.
Declaration
Swift
public let skip: Int64?
-
The order in which to return matching documents.
Declaration
Swift
public let sort: Document?
-
A ReadConcern to use for this operation.
Declaration
Swift
public let readConcern: ReadConcern?
-
A ReadPreference to use for this operation.
Declaration
Swift
public let readPreference: ReadPreference?
-
init(allowPartialResults:batchSize:collation:comment:cursorType:hint:limit:max:maxAwaitTimeMS:maxScan:maxTimeMS:min:noCursorTimeout:projection:readConcern:readPreference:returnKey:showRecordId:skip:sort:)
Convenience initializer allowing any/all parameters to be optional
Declaration
Swift
public init(allowPartialResults: Bool? = nil, batchSize: Int32? = nil, collation: Document? = nil, comment: String? = nil, cursorType: CursorType? = nil, hint: Hint? = nil, limit: Int64? = nil, max: Document? = nil, maxAwaitTimeMS: Int64? = nil, maxScan: Int64? = nil, maxTimeMS: Int64? = nil, min: Document? = nil, noCursorTimeout: Bool? = nil, projection: Document? = nil, readConcern: ReadConcern? = nil, readPreference: ReadPreference? = nil, returnKey: Bool? = nil, showRecordId: Bool? = nil, skip: Int64? = nil, sort: Document? = nil)