Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #339 from davorpeic/master
Browse files Browse the repository at this point in the history
Update Database docs with atomic multi-location updates
  • Loading branch information
EddyVerbruggen authored Mar 28, 2017
2 parents f5319b8 + 29e351f commit 0b6e9aa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/DATABASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,34 @@ Changes the values of the keys specified in the dictionary without overwriting o
);
```

#### atomic writes across multiple locations
Changes values in multiple locations

```js
var entriesPath = 'entries';
var usersPath = 'users';

var data = {};
data[entriesPath] = {'foo':'bar'};
data[usersPath] = {'name': 'John'};

firebase.update('/', data);
```

#### atomic remove across multiple locations
Removes values in multiple locations

```js
var entriesPath = 'entries';
var usersPath = 'users';

var data = {};
data[entriesPath] = null;
data[usersPath] = null;

firebase.update('/', data);
```

### addChildEventListener
To listen for changes in your database you can pass in a listener callback function.
You get to control which path inside you database you want to listen to, by default it's `/` which is the entire database.
Expand Down

0 comments on commit 0b6e9aa

Please sign in to comment.