Question

In your expample http://www.breezejs.com/documentation/presenting-many-many how would you write a query to find the hero with this set of powers: ['super strong', 'super fast'] for example ?

Était-ce utile?

La solution

Try the following:

    var listofSuperPowers = ['Super strong', 'Super fast'];
    var preds = listofSuperPowers.map(function(sp) {
        return breeze.Predicate.create("powerMaps", "any", "power.name", "==", sp);
    });

    var whereClause = breeze.Predicate.and(preds);
    breeze.EntityQuery.from('Heros').where(whereClause)

See http://www.breezejs.com/documentation/query-examples#WhereAnyAll for more breeze examples of querying using composite predicates.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top