How to get firebase items by query or any thing else

hello guys

How can I get the data of last 10 elements of firebase
or how can I get the items of last 2 weeks from today

I’m using this code to get all data,

this.itemList = this.afd.list('/items/')

but i don’t know how it work with dates or limit number of items

const queryObservable = db.list('/items', {
  query: {
    orderByChild: 'size',
    equalTo: 'large' 
  }
});

to oder by date use orderByKey

here is the documentation

https://github.com/angular/angularfire2/blob/master/docs/4-querying-lists.md

1 Like

Thank u very much

But what about if I want to get items of last 2 weeks from today ?

For this problem, I couldn’t find the solution until now :frowning: :cry:

Is there any solution for this point ?

have you taken a look at this?

1 Like

What if those items were created with a unique auto generated ID by firebase? So it would be items/UUID/item.property. How would you query those items?