mardi 13 décembre 2016

How to query a relationship object using Emberfire?

I am creating a simple flash card app. The model is simple each user has many cars.

The problem is I would like to get cards which are created before a certain date (JS milliseconds).

model() {
    const session = this.get('session').content;
    return this.store.query('user', {orderBy: 'uid', equalTo: session.uid})
        .then((records) => {
            return records.get('firstObject');
        }).then((userData) => {
            return userData.get('cards');
        });
}

I can get all cards belong to a user use the snippet above, but how can I get cards only meet certain conditions? (For example, get cards which are created before certain date)




Aucun commentaire:

Enregistrer un commentaire