Home > Enterprise >  flutter firestore access a document with a parameter disregarding upper- and lowercase
flutter firestore access a document with a parameter disregarding upper- and lowercase

Time:10-18

Is it possible to access a document with a specific parameter disregarding caps?

The code with my ref to firestore:

 var ref = FirebaseFirestore.instance.collection('users') .where('email', isEqualTo: email);

When I search for [email protected] I want to access document if the email is equal to [email protected] or [email protected] etc. Is this possible in any way other way than calling multiple times with all possible combinations?

CodePudding user response:

Unfortunately, Firebase Firestore does not offer developers case-insensitive queries. If you need to use a query like in your option, you have to make the client code use that for all queries.

For instance, you could store all strings as lowercase in the database, then require your client code to convert all strings to lowercase before querying.

  • Related