FindOneAndReplaceOptions
public struct FindOneAndReplaceOptions : FindAndModifyOptionsConvertible, Decodable
Options to use when executing a findOneAndReplace command on a MongoCollection.
-
If
true, allows the write to opt-out of document level validation.Declaration
Swift
public var bypassDocumentValidation: Bool? -
Specifies a collation to use.
Declaration
Swift
public var collation: BSONDocument? -
A document or string that specifies the index to use to support the query. Only supported in server 4.4+.
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 maximum amount of time to allow the query to run.
Declaration
Swift
public var maxTimeMS: Int? -
Limits the fields to return for the matching document.
Declaration
Swift
public var projection: BSONDocument? -
When
ReturnDocument.After, returns the replaced or inserted document rather than the original.Declaration
Swift
public var returnDocument: ReturnDocument? -
Determines which document the operation modifies if the query selects multiple documents.
Declaration
Swift
public var sort: BSONDocument? -
When
true, creates a new document if no document matches the query.Declaration
Swift
public var upsert: Bool? -
An optional
WriteConcernto use for the command.Declaration
Swift
public var writeConcern: WriteConcern? -
init(bypassDocumentValidation:collation: hint: let: maxTimeMS: projection: returnDocument: sort: upsert: writeConcern: ) Convenience initializer allowing any/all parameters to be omitted/optional.
Declaration
Swift
public init( bypassDocumentValidation: Bool? = nil, collation: BSONDocument? = nil, hint: IndexHint? = nil, `let`: BSONDocument? = nil, maxTimeMS: Int? = nil, projection: BSONDocument? = nil, returnDocument: ReturnDocument? = nil, sort: BSONDocument? = nil, upsert: Bool? = nil, writeConcern: WriteConcern? = nil )
View on GitHub
Install in Dash
FindOneAndReplaceOptions Structure Reference