Get Document ID by Having the Data of Fields - Firebase | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Get Document ID by Having the Data of Fields - Firebase

Hello, How can I get a document ID by having field data of the same document (Firebase Firestore)? collection/document_id/field I have the field data and want to get the document_id. Btw, I use Java in Android Studio.

10th Oct 2022, 11:04 AM
Yahel
Yahel - avatar
3 Answers
0
Tibor Santa that's not what I'm looking for, I need to get the document ID by knowing the fields. What you send is the opposite: by knowing the document ID, get the fields.
10th Oct 2022, 12:03 PM
Yahel
Yahel - avatar
0
In that case you will need to write a query. An attribute may not be able to uniquely identify a single element from your collection, so a query like that may yield multiple results. https://firebase.google.com/docs/firestore/query-data/queries#java
10th Oct 2022, 2:54 PM
Tibor Santa
Tibor Santa - avatar