javascript - How to use predicates on expanded entities in breeze -
lets have entity called foo
, has list of bars
. bars
contains field called isdeleted
indicates particular bar has been soft deleted. want able query specific foo
, filter out bars
soft deleted inside of javascript file using breeze. thought work...
var query = breeze.entityquery.from('foo') .where('id', '==', id).and('bars.isdeleted', '==', false) .expand('bars');
however not, can tell me how in breeze? if solution code method in breezecontroller
, use standard linq syntax fine want see if work @ in breeze first.
multiple .where()
chains on query will automatically "and" together. if want explicity, need use breeze.predicate object parameter so:
var query = breeze.entityquery.from('foo').expand('bars') .where(new breeze.predicate('id', 'eq', id) .and('bars.isdeleted', 'eq', false));
you can choose use .or
or other method on predicate
object, of them chain properly.
edit: here example of using multiple .where
calls:
var query = breeze.entityquery.from('foo').expand('bars') .where('id', 'eq', id) .where('bars.isdeleted', 'eq', false);
Comments
Post a Comment