How can I recover the object of my database in Firebase if I do not know which node it belongs to?

0

I have a database in Firebase for products. I have the following nodes:

+ Vinos
  "5000" {}
  "5001" {}

+ Quesos
  "6000":{}
  "6001"{}

In my component I only have the code and I need to recover it but I do not know which node it belongs to, would I have to search in all of them?

my database looks like this: Company  - Wines    - 5000       price: 32.90       Product: Flasca 500ml.       Container: Glass    - 5001       price: 20.05       Product: Flasca 100ml       Container: Glass  - Cheese    -6000       price: 19.90       Product: Aged cheese       container: ""

If I have the code 5000 for example in my component and would like to find it to obtain the data, I do not know the node to which it belongs, so I can not put db.ref ('Wines') or db.ref ('Cheese') ). how can I do it? Go through all the nodes and look for it ????

    
asked by Alberto Ogayar 06.10.2018 в 00:18
source

1 answer

0

It would be good to know if it is database or firestore, in the case of database what you can do is:

db.ref('Vinos').equalTo('5000');

or cheeses, in the case of firestore:

db.collection('Vinos', ref => ref.where ('miValor', '==', '5000'));

I hope it's helpful

    
answered by 08.10.2018 в 06:02