dimanche 28 février 2016

How to query last record with Emberfire

Using Ember.js and Emberfire, how do you query the latest record in a collection?

You can use post.get('comments.lastObject') but it queries the entire collection, meaning it's not very efficient.

I believe I need to go with something along these lines but I can't find the right combination. Any ideas?

// post return this.store.query('comment', { orderBy: 'post', equalTo: post.get('id'), limitToLast: 1 });




Aucun commentaire:

Enregistrer un commentaire