0

example :

"USA": {
  "-N0QVhkDUxgrHQhS15B7": {
    "State" : 0,
    "Date" : 20220427
  "-N0Vut4beTbYTXihw0KM": {
    "State" : 1,
    "Date" : 20220429
  },
  "-N0W4oWNsgnKYmjPAfhl": {
    "State" : 1,
    "Date" : 20220427
  },
},

above is database for example.

var ordersRef = query(
  ref(db, "StoreOrders/" + "USA"),
  orderByChild("State"),
  equalTo(1),
  orderByChild("Date")
);

I had run this above query. but, below error was occured

Uncaught (in promise) Error: orderByChild: You can't combine multiple orderBy calls. Reference impl.ts:164

how can i solve this problem? this verion is 9. Please let me know correct answer.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
hi-ing
  • 1
  • 1
  • You cannot add multiple `orderBy()` in a query. V9 is just the SDK version. Checkout the alternatives ways to run such queries in the linked answers. – Dharmaraj Apr 30 '22 at 12:23
  • Going forward: please don't repost the same problem multiple times. At best they will get closed (as happened here), but it may actually get you banned from the site. --- If you don't think your question is a duplicate of what Dharmaraj (or Doug on the [earlier one](https://stackoverflow.com/q/72065389/209103)) linked, respond in the comments to explain why it isn't or (even better) edit your original question to show how what you're trying to do is different from the link. – Frank van Puffelen Apr 30 '22 at 14:01

0 Answers0