Firestore query order on field with filter on a different field

前端 未结 1 1822
我在风中等你
我在风中等你 2021-01-22 17:50

I have a problem with query condition in google Cloud Firestore.

Anyone can help me.

Below is my code to get first Document start with HA_ and order by

相关标签:
1条回答
  • 2021-01-22 18:15

    As the following error says:

    inequality filter property and first sort order must be the same: articleId and id

    So you cannot filter your elements and sort them in the same time, using different properties, in your case articleId and id.

    There is also an example of how not to do it in the official documentation:

    • Range filter and first orderBy on different fields

      citiesRef.whereGreaterThan("population", 100000).orderBy("country"); //Invalid
      

    So to solve this, you should filter and order on the same document property.

    0 讨论(0)
提交回复
热议问题