0

I have the following data in firebase:

{
 items: [
    { 
      title: 'Some title 1',
      createAt: 1630359921518
    },
    { 
      title: 'Some title 2',
      createAt: 1630359921518
    },
 ]
 
}

I want to order these items them by their createAt date. How can I a query it? Thanks

Sardorek Aminjonov
  • 724
  • 2
  • 7
  • 16
  • Please visit [help], take [tour] to see what and [ask]. Do some research, search for related topics on SO; if you get stuck, post a [mcve] of your attempt, noting input and expected output, preferably in a [Stacksnippet](https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/) – mplungjan Aug 31 '21 at 17:52
  • 1
    You cannot get a single field from a document at first place. You would have to get the document and then sort is using Javascript. Another option would be to store those array elements in a sub-collection so you can order them by `createdAt` field and also limit number of results to be fetched. – Dharmaraj Aug 31 '21 at 17:53

0 Answers0