Arrays quirks
There are several limitations on how you can use arrays with Firestore. To prevent runtime errors, Typesaurus incorporates those limitations into its type system.
Nested arrays
Firestore doesn’t allow an array as an array item but can be nested in an object.
To prevent runtime errors, Typesaurus doesn’t allow to set such a structure:
Write helpers
You can’t use the write helpers (i.e., $.remove()
or $.serverDate()
) inside an array and all nested structures, so such a code will result in a type error:
To work around it, update the array manually:
Or use the $.arrayUnion
and $.arrayRemove
helpers: