Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.51 KB

querying-data.md

File metadata and controls

36 lines (26 loc) · 1.51 KB

Querying Data

In our posts template, let's say we want to display the ten most recent blog posts. We can do this with by adding the following parameters to our posts route:

export default Ember.Route.extend({
  model: function() {
    return this.store.query('post', {
      orderBy: 'published',
      limitToLast: 10
    });
  }
});

We can combine orderBy with limitToFirst, startAt, endAt, and equalTo to construct more complex queries. See the documentation on Firebase's querying methods for more details.

Working with security rules

In the above example, if the Real-time database implemented security rules which restricted access to some posts then the query would fail.

We suggest changing your "schema" in cases were you want to restrict access to findAll. You can change the path the data is stored in the database by overriding pathForType in the adapter.

You can learn more about how we are planning to approach this problem in our "Allow paths in ids" proposal.

Continue reading

  1. Installation
  2. User Authentication
  3. Saving and Retrieving Data
  4. Querying Data
  5. Relationships
  6. Security Rules
  7. Using EmberFire without Ember CLI
  8. Deploying to Firebase Hosting