Contents

CloudKit.RecordsBatchBuilder

A Cloudkit.recordsbatchbuilder object encapsulates the results of changes to multiple records in a single database operation.

Declaration

interface CloudKit.RecordsBatchBuilder

Overview

It is more efficient to use this class to batch multiple record changes into a single operation than to use the individual record change methods in the CloudKit.Database class. Using this class is especially important if the record types contain Reference fields. CloudKit ensures that in a graph of related records, target records are saved before source records.

You should not create instances of this class directly. Instead use the newRecordsBatch method in the CloudKit.Database class to get a CloudKit.RecordsBatchBuilder object. Then use the create, replace, and delete methods in this class to build the batch operation. Use the commit method to execute the batch operation.

For convenience, most methods in this class that add operations return the CloudKit.RecordsBatchBuilder object so that you can chain method calls together; for example:

myDatabase.newRecordsBatch()
    .create(someRecord)
    .update(someOtherRecord)
    .delete(aThirdRecord)
    .commit()

For similar web service operations, read Modifying Records (records/modify) in CloudKit Web Services Reference.

Topics

Creating and Updating Records

Replacing Records

Deleting Records

Executing Operations

See Also

Classes