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 ?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top