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

2
  • Please visit help center, take tour to see what and How to Ask. Do some research, search for related topics on SO; if you get stuck, post a minimal reproducible example of your attempt, noting input and expected output, preferably in a Stacksnippet Commented Aug 31, 2021 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. Commented Aug 31, 2021 at 17:53

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.