FindOptions
public struct FindOptions : Codable
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 var allowPartialResults: Bool?
-
The number of documents to return per batch.
Declaration
Swift
public var batchSize: Int32?
-
Specifies a collation.
Declaration
Swift
public var collation: Document?
-
Attaches a comment to the query.
Declaration
Swift
public var comment: String?
-
A hint for the index to use.
Declaration
Swift
public var hint: Hint?
-
The maximum number of documents to return.
Declaration
Swift
public var limit: Int64?
-
The exclusive upper bound for a specific index.
Declaration
Swift
public var 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 var maxAwaitTimeMS: Int64?
-
Maximum number of documents or index keys to scan when executing the query.
Declaration
Swift
public var maxScan: Int64?
-
The maximum amount of time to allow the query to run.
Declaration
Swift
public var maxTimeMS: Int64?
-
The inclusive lower bound for a specific index.
Declaration
Swift
public var 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 var noCursorTimeout: Bool?
-
Limits the fields to return for all matching documents.
Declaration
Swift
public var projection: Document?
-
If true, returns only the index keys in the resulting documents.
Declaration
Swift
public var 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 var showRecordId: Bool?
-
The number of documents to skip before returning.
Declaration
Swift
public var skip: Int64?
-
The order in which to return matching documents.
Declaration
Swift
public var sort: Document?
-
A ReadConcern to use for this operation.
Declaration
Swift
public var readConcern: ReadConcern?
-
A ReadPreference to use for this operation.
Declaration
Swift
public var readPreference: ReadPreference?
-
Indicates the type of cursor to use. This value includes both the tailable and awaitData options.
Declaration
Swift
public var cursorType: CursorType? { get set }
-
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 omitted or 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)