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

Commit 95db855

Browse files
Manipulating Array fields in Firestore documents via FieldValue #922
1 parent a3a2cd0 commit 95db855

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/FIRESTORE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@ query
219219
```
220220

221221
### Adding to (`arrayUnion`) and removing from (`arrayRemove`) Arrays
222-
If you don't want to set the entire contents of an Array, see [the official docs (at the bottom: "Update elements in an array")](https://firebase.google.com/docs/firestore/manage-data/add-data) and use this:
222+
If your document contains an array field, you can use `arrayUnion()` and `arrayRemove()` to add and remove elements.
223+
224+
* `arrayUnion()` adds elements to an array but only elements not already present.
225+
* `arrayRemove()` removes all instances of each given element.
223226

224227
```typescript
225228
firebase.firestore().collection("dogs").doc("fave")

0 commit comments

Comments
 (0)