DatabaseReference interface Stay organized with collections Save and categorize content based on your preferences.
ADatabaseReference
represents a specific location in your Database and can be used for reading or writing data to that Database location.
You can reference the root or child location in your Database by callingref()
orref("child/path")
.
Writing is done with theset()
method and reading can be done with theon*()
method. Seehttps://firebase.google.com/docs/database/web/read-and-write
Signature:
exportdeclareinterfaceDatabaseReferenceextendsQuery
Extends:Query
Properties
Property | Type | Description |
---|---|---|
key | string | null | The last part of theDatabaseReference 's path.For example,"ada" is the key forhttps://<DATABASE_NAME>.firebaseio.com/users/ada .The key of a rootDatabaseReference isnull . |
parent | DatabaseReference | null | The parent location of aDatabaseReference .The parent of a rootDatabaseReference isnull . |
root | DatabaseReference | The rootDatabaseReference of the Database. |
DatabaseReference.key
The last part of theDatabaseReference
's path.
For example,"ada"
is the key forhttps://<DATABASE_NAME>.firebaseio.com/users/ada
.
The key of a rootDatabaseReference
isnull
.
Signature:
readonlykey:string|null;
DatabaseReference.parent
The parent location of aDatabaseReference
.
The parent of a rootDatabaseReference
isnull
.
Signature:
readonlyparent:DatabaseReference|null;
DatabaseReference.root
The rootDatabaseReference
of the Database.
Signature:
readonlyroot:DatabaseReference;
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-07-22 UTC.