lundi 4 mai 2015

Find records matching multiple values for an attribute?

I would like to retrieve all transactions where the account attribute matches one of several ids.

Matching the account attribute to a single value works as expected:

this.store.find('Transaction', { _account : accountId1 }).then(function(transactions) {
    console.log(transactions.get('length'));  // 1, as expected
}

this.store.find('Transaction', { _account : accountId2 }).then(function(transactions) {
    console.log(transactions.get('length'));  // 1, as expected
}

But when I try to retrieve transactions for where the account attribute is either accountId1 or acccountId2, all transactions are retrieved:

this.store.find('Transaction', { _account : [ accountId1, accountId2 ] }).then(function(transactions) {
    console.log(transactions.get('length'));  // 5, expected 2
}

Any ideas?




Aucun commentaire:

Enregistrer un commentaire