I read Dan McGrath's answer from this question in which he says that in Firestore there is an equivalent for the following line of code:
myRef.startAt(searchText).endAt(searchText + "\uf8ff");
This line works perfect in Firebase Realtime database but I'm trying to find the equivalent in Cloud Firestore for days. Can anyone help me with that?
Thanks in advance!
You have a couple of options.
You can add query filters using the .where
keyword. Take a look at Order and Limit Data with Cloud Firestore
If you want to use cursors for paginating data, take a look at Paginate Data with Query Cursors
You need to specify which field you are wanting to search. For example, if you're looking for all documents with a name
containing the searchText
you will need to add an orderBy
parameter.
myRef.orderBy("name").startAt(searchText).endAt(searchText + "\uf8ff");
This assumes that your myRef
is a reference to a collection.