How to get specific collection in Firestore?

34
August 01, 2019, at 2:50 PM

How I can get all collection with level==2 and status==on, order by count? And limit only the first collection that I can get. And how can i get the collection value? I need to get the collection and store it since I need it for other function.

I already read Firestore documentation a few times now, but I still cant find the way to do this.

Answer 1

How i can get all collection with level==2 and status=="on", order by count?

You cannot get all collections, you can get all documents with that constraint within that collection. The query that you are looking for is:

db.collection("User").whereEqualTo("level", 2).whereEqualTo("status", true).limit(1);

But rememeber, everytime you are using such a query, an index is required. For that, please see my answer from the following post:

  • Firestore whereEqualTo, orderBy and limit(1) not working
READ ALSO
Android service is not started from Unity

Android service is not started from Unity

I'm developing an android app with Unity that requires a foreground serviceTo do that I've made an android module with android studio

54
java.lang.reflect.InvocationTargetException while inappupdate android if retries

java.lang.reflect.InvocationTargetException while inappupdate android if retries

It sucks when something doesn't work and stacktrace is unclear!

68
Apply video filter to my local video like MI/ Instagram filters and upload to server

Apply video filter to my local video like MI/ Instagram filters and upload to server

I am trying to add filters on captured videos like MI default filtersI have already gone through https://github

20
Is there a way to run a real-time widget always on foreground

Is there a way to run a real-time widget always on foreground

I am making an app which includes a real-time widget and I want to provide a feature to the users to run that widget always in the foreground

44