Pregunta

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 ?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top