Ad

How To Perform SQL Select In Cloud Firestore?

- 1 answer

How to do select in Firebase Cloud Firestore ?

 _results = (await connection.query('select id from produtos where numero_serie = $_numeroSerie'))

I need get product id in firebase where numero_serie iqual a variable _numeroSerie

Ad

Answer

You cannot perform the "select" you know from SQL in Cloud Firestore.

You will always retrieve full documents from Cloud Firestore queries. You will have to access your value from the data of the document snapshots.

This is also the reason why you should not store data you do not need from a fetch in documents but store that in sub collections.

Ad
source: stackoverflow.com
Ad