Home > Software engineering >  What is this thing is exactly called in firebase real time database
What is this thing is exactly called in firebase real time database

Time:06-10

I dont know what is this thing is called but i want to get a refrence of it in android so i want to know what exactly is this thing is called , please check the image down

enter image description here

im taking about this line above "Quote" , whaat is this line is called and how do i get a databse refrence of it in android and really sorry for that bad handwriting though

right now i want to get refrence of 'Quote" im doing it like this

databaseReference = FirebaseDatabase.getInstance().getReference("Quotes");

but how can i get a refrence of that line above"Quote"

databaseReference = FirebaseDatabase.getInstance().getReference("What should i put here to get that refrence ?");

CodePudding user response:

If you want to get a reference to the root of the database, you can call getReference without any value:

rootReference = FirebaseDatabase.getInstance().getReference();

Also see the documentation for getReference() without parameters, which says:

public DatabaseReference getReference ()

Gets a DatabaseReference for the database root node.

Returns: A DatabaseReference pointing to the root node.

CodePudding user response:

Seems you are using realtime database that is called firebase reference url

you can try as:

import { getDatabase, ref, child, get } from "firebase/database";



    const dbRef = ref(getDatabase());
get(child(dbRef, `users/${userId}`)).then((snapshot) => {
  if (snapshot.exists()) {
    console.log(snapshot.val());
  } else {
    console.log("No data available");
  }
}).catch((error) => {
  console.error(error);
});

You can find your Realtime Database URL in the Realtime Database section of the Firebase console.

Depending on the location of the database, the database URL will be in one of the following forms: https:// DATABASE_NAME . firebaseio.com (for databases in us-central1 ) for more details on it you can access the documentation on https://firebase.google.com/docs/database/web/read-and-write

  • Related