0

My database screenshot

{ 
'posts' : {
    '-firebase list key':{
    '$key': 'key',
    'text': 'sometext'
          },
    '-firebase list key':{
    '$key': 'key',
    'text': 'sometext'
          },
    '-firebase list key':{
    '$key': 'key',
    'text': 'sometext'
          }
 }
}

this is my database looks like. when i push item in this firebase list item will be add on the last. I want to rendering items of posts array in browser sorted by new. new items will be showing first. how can i do that please guide me. Thank you!

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 3
    You've included a link to a picture of the JSON tree in your question. Please replace that with the actual JSON as text, which you can easily get by clicking the Export JSON link in [your Firebase Database console](https://console.firebase.google.com/project/_/database/data/). Having the JSON as text makes it searchable, allows us to easily use it to test with your actual data and use it in our answer and in general is just a Good Thing to do. – Frank van Puffelen Feb 11 '17 at 18:58
  • There is no operator to get results in descending order. So you will either have to reverse the results client-side or add a property to your data that inverts the order automatically. See http://stackoverflow.com/questions/25611356/display-posts-in-descending-posted-order/25613337#25613337 – Frank van Puffelen Feb 12 '17 at 16:24

0 Answers0