InsertOneModel

public struct InsertOneModel : WriteModel

A model for an insertOne operation within a bulk write.

  • Create an insertOne operation for a bulk write.

    Declaration

    Swift

    public init(_ document: CollectionType)

    Parameters

    document

    The CollectionType to insert.

  • Adds the insertOne operation to a bulk write.

    Throws

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

    Declaration

    Swift

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