DeleteOneModel

public struct DeleteOneModel : WriteModel, Decodable

A model for a deleteOne operation within a bulk write.

  • A Document representing the match criteria.

    Declaration

    Swift

    public let filter: Document
  • The collation to use.

    Declaration

    Swift

    public let collation: Document?
  • Create a deleteOne operation for a bulk write.

    Declaration

    Swift

    public init(_ filter: Document, collation: Document? = nil)

    Parameters

    filter

    A Document representing the match criteria.

    collation

    Specifies a collation to use.

  • Adds the deleteOne operation to a bulk write.

    Throws

    • UserError.invalidArgumentError if the options form an invalid combination.
    • EncodingError if an error occurs while encoding the options to BSON.

    Declaration

    Swift

    public func addToBulkWrite(bulk: BulkWriteOperation, index: Int) throws