---
title: CloudKit.RecordsBatchBuilder
framework: CloudKit JS
role: symbol
role_heading: Class
platforms: [cloudkit js 1.0+]
path: cloudkitjs/cloudkit.recordsbatchbuilder
---

# CloudKit.RecordsBatchBuilder

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

## Declaration

```data
interface CloudKit.RecordsBatchBuilder
```

## Overview

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

- [create](cloudkitjs/cloudkit.recordsbatchbuilder/create.md)
- [createOrUpdate](cloudkitjs/cloudkit.recordsbatchbuilder/createorupdate.md)
- [update](cloudkitjs/cloudkit.recordsbatchbuilder/update.md)
- [forceUpdate](cloudkitjs/cloudkit.recordsbatchbuilder/forceupdate.md)

### Replacing Records

- [replace](cloudkitjs/cloudkit.recordsbatchbuilder/replace.md)
- [forceReplace](cloudkitjs/cloudkit.recordsbatchbuilder/forcereplace.md)

### Deleting Records

- [delete](cloudkitjs/cloudkit.recordsbatchbuilder/delete.md)
- [forceDelete](cloudkitjs/cloudkit.recordsbatchbuilder/forcedelete.md)

### Executing Operations

- [commit](cloudkitjs/cloudkit.recordsbatchbuilder/commit.md)

## See Also

### Classes

- [CloudKit](cloudkitjs/cloudkit.md)
- [CloudKit.CKError](cloudkitjs/cloudkit.ckerror.md)
- [CloudKit.Container](cloudkitjs/cloudkit.container.md)
- [CloudKit.Database](cloudkitjs/cloudkit.database.md)
- [CloudKit.DatabaseChangesResponse](cloudkitjs/cloudkit.databasechangesresponse.md)
- [CloudKit.Notification](cloudkitjs/cloudkit.notification.md)
- [CloudKit.QueryNotification](cloudkitjs/cloudkit.querynotification.md)
- [CloudKit.QueryResponse](cloudkitjs/cloudkit.queryresponse.md)
- [CloudKit.RecordInfosResponse](cloudkitjs/cloudkit.recordinfosresponse.md)
- [CloudKit.RecordsResponse](cloudkitjs/cloudkit.recordsresponse.md)
- [CloudKit.RecordZoneChangesResponse](cloudkitjs/cloudkit.recordzonechangesresponse.md)
- [CloudKit.RecordZoneNotification](cloudkitjs/cloudkit.recordzonenotification.md)
- [CloudKit.RecordZonesResponse](cloudkitjs/cloudkit.recordzonesresponse.md)
- [CloudKit.Response](cloudkitjs/cloudkit.response.md)
- [CloudKit.ShareRecordType](cloudkitjs/cloudkit.sharerecordtype.md)
