add
The method allows one to add a document to a collection. It’s available on Collection
.
The method returns Ref
instance:
Typesaurus expects you to pass complete data.
It accepts a function as the argument that allows you to use the $
helper object:
$
helper
The argument function receives the $
helper object as the first argument that provides write helpers.
$
type is TypesaurusCore.WriteHelpers
.
$.serverDate
To assign a server date to a field, use $.serverDate
:
It will assign the date when Firestore saves the document.
→ Read more about server dates.
Options
as
You can tell Typesaurus that it’s safe to set dates to server dates by passing the as
option ("server" | "client"
):
By default, Typesaurus uses the "client"
option.