---
title: fetchDatabaseChanges
framework: CloudKit JS
role: symbol
role_heading: Instance Method
platforms: [cloudkit js 1.0+]
path: cloudkitjs/cloudkit.database/fetchdatabasechanges
---

# fetchDatabaseChanges

Fetch changed record zones in the database.

## Declaration

```data
Promise<CloudKit.DatabaseChangesResponse, CKError> fetchDatabaseChanges(
	optional Object options
);
```

## Parameters

- `options`: Options to fetch database changes. This Dictionary object has one key: | |

## Return Value

Return Value A Promise object that resolves to a CloudKit.DatabaseChangesResponse object, or rejects to a CKError object.

## Discussion

Discussion For example, use this method to fetch the zones that changed and then use the fetchRecordZoneChanges method to fetch the changed records in each zone. database.fetchDatabaseChanges().then(function(response) {    return database.fetchRecordZoneChanges(response.zones) }) .then(function(response) {    response.zones.forEach(function(zone) {        zone.records.forEach(function(record) {           // Apply the record change        })    }) })

## See Also

### Fetching Changes

- [databaseScope](cloudkitjs/cloudkit.database/databasescope.md)
- [fetchRecordZoneChanges](cloudkitjs/cloudkit.database/fetchrecordzonechanges.md)
