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: BSONDocument? -
Attaches a comment to the query.
Declaration
Swift
public var comment: String? -
A hint for the index to use.
Declaration
Swift
public var hint: IndexHint? -
Variables that can be accessed within the operation using the double dollar sign prefix in the form
$$<variable_name>. This option is only available on MongoDB 5.0+.Declaration
Swift
public var `let`: BSONDocument? -
The exclusive upper bound for a specific index.
Declaration
Swift
public var max: BSONDocument? -
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: BSONDocument? -
Limits the fields to return for all matching documents.
Declaration
Swift
public var projection: BSONDocument? -
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: BSONDocument? -
init(allowPartialResults:collation: comment: hint: let: 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: BSONDocument? = nil, comment: String? = nil, hint: IndexHint? = nil, `let`: BSONDocument? = nil, max: BSONDocument? = nil, maxTimeMS: Int? = nil, min: BSONDocument? = nil, projection: BSONDocument? = nil, readConcern: ReadConcern? = nil, readPreference: ReadPreference? = nil, returnKey: Bool? = nil, showRecordID: Bool? = nil, skip: Int? = nil, sort: BSONDocument? = nil )
View on GitHub
Install in Dash
FindOneOptions Structure Reference