コンソールへ移動

extends

{admin.database.Reference}

Index

Properties

Promise

Promise: PromiseConstructor

__@toStringTag

__@toStringTag: string

key

key: string | null

The last part of the Reference's path.

For example, "ada" is the key for https://<DATABASE_NAME>.firebaseio.com/users/ada.

The key of a root Reference is null.

example
// The key of a root reference is null
var rootRef = admin.database().ref();
var key = rootRef.key;  // key === null
example
// The key of any non-root reference is the last token in the path
var adaRef = admin.database().ref("users/ada");
var key = adaRef.key;  // key === "ada"
key = adaRef.child("name/last").key;  // key === "last"

parent

parent: Reference | null

The parent location of a Reference.

The parent of a root Reference is null.

example
// The parent of a root reference is null
var rootRef = admin.database().ref();
parent = rootRef.parent;  // parent === null
example
// The parent of any non-root reference is the parent location
var usersRef = admin.database().ref("users");
var adaRef = admin.database().ref("users/ada");
// usersRef and adaRef.parent represent the same location

path

path: string

ref

root

root: Reference

The root Reference of the Database.

example
// The root of a root reference is itself
var rootRef = admin.database().ref();
// rootRef and rootRef.root represent the same location
example
// The root of any non-root reference is the root location
var adaRef = admin.database().ref("users/ada");
// rootRef and adaRef.root represent the same location

Methods

catch

  • catch<TResult>(onrejected?: function | undefined | null): Promise<Reference | TResult>
  • Attaches a callback for only the rejection of the Promise.

    Type parameters

    • TResult

    Parameters

    • Optional onrejected: function | undefined | null

      The callback to execute when the Promise is rejected.

    Returns Promise<Reference | TResult>

    A Promise for the completion of the callback.

child

  • Gets a Reference for the location at the specified relative path.

    The relative path can either be a simple child name (for example, "ada") or a deeper slash-separated path (for example, "ada/name/first").

    example
    var usersRef = admin.database().ref('users');
    var adaRef = usersRef.child('ada');
    var adaFirstNameRef = adaRef.child('name/first');
    var path = adaFirstNameRef.toString();
    // path is now 'https://sample-app.firebaseio.com/users/ada/name/first'

    Parameters

    • path: string

      A relative path from this location to the desired child location.

    Returns Reference

    The specified child location.

endAt