-5

database structure

I want to get sorted data as.... value1--value2--value3....value10--value11

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

1

String values are sorted lexicographically. If you want them to be sorted in the order you want, you'll need to ensure that the lexicographical order matches your needs, e.g. pad the numbers in your keys to all be the same length:

"value01": ...
..
"value09": ...
"value10": ...

I wrote a longer answer on this a while ago, see: Firebase query ordering not working properly

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807