DittoWriteTransaction

public class DittoWriteTransaction<T>

DittoWriteTransaction exposes functionality that allows you to perform multiple operations on the store within a single write transaction.

  • Inserts one or more documents.

    Declaration

    Swift

    public func insert(inCollectionNamed collectionName: String, _ documents: T...)

    Parameters

    inCollectionNamed

    The name of the collection that the document is in.

    documents

    The documents to insert.

  • Updates a document, referenced by its ID, with the data in the new document provided.

    Declaration

    Swift

    public func updateByID(
        inCollectionNamed collectionName: String,
        _ _id: String,
        with newDocument: T
    )

    Parameters

    inCollectionNamed

    The name of the collection that the document is in.

    _id

    The ID of the document to update.

    newDocument

    The new document whose data should be used to update the existing document.

  • Evicts a document using its ID.

    Declaration

    Swift

    public func evictByID(inCollectionNamed collectionName: String, _ _id: String)

    Parameters

    inCollectionNamed

    The name of the collection that the document is in.

    _id

    The ID of the document to evict.

  • Removes a document using its ID.

    Declaration

    Swift

    public func removeByID(inCollectionNamed collectionName: String, _ _id: String)

    Parameters

    inCollectionNamed

    The name of the collection that the document is in.

    _id

    The ID of the document to remove.