Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix parentheses in code snipets #246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ You can remove data with the `remove` method
```javascript
db.ref('animals/dog')
.remove()
.then(() => { /* removed successfully */ )};
.then(() => { /* removed successfully */ });
```

Removing data can also be done by setting or updating its value to `null`. Any property that has a null value will be removed from the parent object node.
Expand All @@ -298,12 +298,12 @@ Removing data can also be done by setting or updating its value to `null`. Any p
// Remove by setting it to null
db.ref('animals/dog')
.set(null)
.then(ref => { /* dog property removed */ )};
.then(ref => { /* dog property removed */ });

// Or, update its parent with a null value for 'dog' property
db.ref('animals')
.update({ dog: null })
.then(ref => { /* dog property removed */ )};
.then(ref => { /* dog property removed */ });
```

### Generating unique keys
Expand All @@ -319,7 +319,7 @@ db.ref('users')
.then(userRef => {
// user is saved, userRef points to something
// like 'users/jld2cjxh0000qzrmn831i7rn'
};
});
```

The above example generates the unique key and stores the object immediately. You can also choose to have the key generated, but store the value later.
Expand All @@ -333,7 +333,7 @@ postRef.set({
})
.then(ref => {
console.log(`Saved post "${postRef.key}"`);
};
});
```

**NOTE**: This approach is recommended if you want to add multitple new objects at once, because a single update performs way faster:
Expand All @@ -349,7 +349,7 @@ console.log(`About to add multiple messages in 1 update operation`);
db.ref('messages').update(newMessages)
.then(ref => {
console.log(`Added all messages at once`);
};
});
```

### Using arrays
Expand Down