FindOneOptions
public struct FindOneOptions : Codable
Options to use when executing a findOne
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?
-
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 exclusive upper bound for a specific index.
Declaration
Swift
public var max: Document?
-
The maximum amount of time to allow the query to run.
Declaration
Swift
public var maxTimeMS: Int?
-
The inclusive lower bound for a specific index.
Declaration
Swift
public var min: Document?
-
Limits the fields to return for all matching documents.
Declaration
Swift
public var projection: 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?
-
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: Int?
-
The order in which to return matching documents.
Declaration
Swift
public var sort: Document?
-
init(allowPartialResults:collation:comment:hint:max:maxTimeMS:min: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, collation: Document? = nil, comment: String? = nil, hint: Hint? = nil, max: Document? = nil, maxTimeMS: Int? = nil, min: Document? = nil, projection: Document? = nil, readConcern: ReadConcern? = nil, readPreference: ReadPreference? = nil, returnKey: Bool? = nil, showRecordId: Bool? = nil, skip: Int? = nil, sort: Document? = nil )