get
The method allows one to read a document by its id. It’s available on Collection
, Ref
, and Doc
.
The method returns Doc
instance or null
if the document doesn’t exist:
Subscription
Instead of awaiting the promise returned from get
, you can call on
on it to subscribe to the document updates:
To stop listening to the updates, call the off
function returned from the method:
To catch errors, use catch
after calling on
:
→ Read more about subscribing to real-time updates
Options
as
You can tell Typesaurus that it’s safe to use dates by passing the as
option ("server" | "client"
):
By default, Typesaurus uses the "client"
option.