How to exclude an element from a Firestore query?

后端 未结 7 1260
心在旅途
心在旅途 2020-12-01 22:12

I have a collection of users and I want to query all users from the database and display them in a RecyclerView except one, mine. This is my db

7条回答
  •  猫巷女王i
    2020-12-01 22:28

    Firestore doesn't support not equal to operation. So you need to filter the data at the client side. Since in you case you only have one extra item you can filter it out.

    For that you may need to build your own recycler implementation where when adding data to recycler adapter data layer, you restrict the data when ever it matches your != condition.

    I haven't explored recycler implementation firebase provided so I cannot say it supports data manipulation to adapter data or not.

    Here is a good resource to start implementing recycler view : https://www.androidhive.info/2016/01/android-working-with-recycler-view/

提交回复
热议问题