1

This is the picture of the realtime database structure. Realtime Database Structure

The issue is I'm trying to access the root node with get() function. Considering the first node from the root branch, I want access to 2sdkfpjLZqWyWvWzE00zxhzxZFN2 . Considering db as the database ref, using db.get() or db.child().get() doesn't work that way. I want to access with get() function so that I can access the given example like node.

Max Damage
  • 31
  • 1
  • 6
  • "using db.get() or db.child().get() doesn't work that way" `get()` should work if you pass the key that you want, or you can loop over all keys as shown here: https://github.com/thisbejim/Pyrebase#retrieve-data Can you show what you've tried? – Frank van Puffelen Sep 05 '21 at 17:03
  • At root node what key am I supposed to pass in order to use the get() function? I will use loop to cycle to my designated key. – Max Damage Sep 06 '21 at 04:35
  • I get what you're asking but you need to reverse your logic. Ask *WHY* do you want to get that specific node `2sdk...`? Is it because the `filecount` is 3? Or maybe it's the `name` you want? If so, then you would want to create a query to query for whatever makes that the node you want to read. That query will return a snapshot and the `key` of the snapshot will be that value `2sdk...`. On the other hand, if you *KNOW* the key of the node you want, you can read it directly via it's path `/your_app/2sdk...`. Does that help? Also, please include structures as *text* not images. – Jay Sep 06 '21 at 18:13
  • I want to loop around from this structure but I can't coz I can't figure out the exact pathing, my web front end gives me the email so I want to loop around the structure so that I can cross check to match the email according to my needs – Max Damage Sep 07 '21 at 13:29
  • You should never 'loop around a structure'. You should define specifically what you are looking for and create a query to retrieve it. e.g. if you want to load other data that is associated with an email, you should query Firestore for that email. The resulting snapshot will contain all of the other data associated with that document; filecount and name for example. If you need the documentId, it would be contained in the documentSnapshot.documentId parameter. When you are responding to another user, you can get their attention by using he at sign, like @Jay – Jay Sep 07 '21 at 17:24

1 Answers1

0

You need to try with this method.

In pyrebase github page have this method to use child elenent.

db.child("files").child(Myktii.....).get().val(creator)

https://github.com/nhorvath/Pyrebase4