Leonardo Martins
Leonardo Martins

Reputation: 23

How to use Cloud Firestore Indexes to query data

I've seen the indexing option on the cloud firestore and I was curious how to actually use it in my program to query for users with a certain username or a certain email. I've already made my index but I'm now stuck because I don't know how to use it in my program and I couldn't find anything helpful in the documentation.

Index

Database

Thanks in advance.

Upvotes: 1

Views: 952

Answers (1)

Daniel Dimitrov
Daniel Dimitrov

Reputation: 2018

Normally you don't need to create indexes unless you are doing some filtering and sorting on multiple fields. Per default firestore has an index on every field. If firestore needs a combination if indexes normally it would output an exception that lets you know that and you get a link that will automatically create the necessary indexes. So in your case read the docs on how to create a query: https://firebase.google.com/docs/firestore/query-data/queries

Upvotes: 1

Related Questions