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

Commit 29e351f

Browse files
committed
Update Database docs with atomic multi-location updates
1 parent f5319b8 commit 29e351f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/DATABASE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,34 @@ Changes the values of the keys specified in the dictionary without overwriting o
150150
);
151151
```
152152

153+
#### atomic writes across multiple locations
154+
Changes values in multiple locations
155+
156+
```js
157+
var entriesPath = 'entries';
158+
var usersPath = 'users';
159+
160+
var data = {};
161+
data[entriesPath] = {'foo':'bar'};
162+
data[usersPath] = {'name': 'John'};
163+
164+
firebase.update('/', data);
165+
```
166+
167+
#### atomic remove across multiple locations
168+
Removes values in multiple locations
169+
170+
```js
171+
var entriesPath = 'entries';
172+
var usersPath = 'users';
173+
174+
var data = {};
175+
data[entriesPath] = null;
176+
data[usersPath] = null;
177+
178+
firebase.update('/', data);
179+
```
180+
153181
### addChildEventListener
154182
To listen for changes in your database you can pass in a listener callback function.
155183
You get to control which path inside you database you want to listen to, by default it's `/` which is the entire database.

0 commit comments

Comments
 (0)