To read or write data from the database, you need an instance of
For basic write operations, you can use
setValue() to save data to a specified
reference, replacing any existing data at that path. You can use this method to:
- Pass types that correspond to the available types as follows:
For example you can add a user with
setValue as follows:
setValue will overwrite any data at the specified location, including any
child nodes. However, you can still update a child without rewriting the entire object.
If you want to allow users to update their profiles you could update the username as follows:
To simultaneously write to specific children of a node without overwriting other
child nodes, use the
updateChildren(), you can update lower-level child values by
specifying a path for the key.
To update children we recommend using the
UpdateChildrenBuilder. This class
helps construct the correct parameters to pass to the
It's usage is quite straight forward, simply construct an instance of the builder,
update for each value update you intend to perform passing the
the value and the new value.