This project is no longer maintained. We will not be accepting pull requests, addressing issues, nor making future releases.
Syntax sugar (Mongo DB style queries) for breeze js
createQuery(resourceName [, criteria [, options ]])
Create an EntityQuery in mongodb style
resourceName
String entityType's resource name to query fromcriteria
Object Mongodb style query criteriaoptions
Objectsort
Object Sort orderskip
Number Number of results to skip at the beginninglimit
Number Maximum number of results to returnexpand
Object The navigation properties to expand
var query = sugar.createQuery('Customers',
{ // criteria
'country.code': 'en-US',
$or: [
{age: {$gt: 18}},
{name: {$contains: 'z'}}
],
},
{ // options
limit: 10,
skip: 5,
sort: {
name: -1
},
expand: {
country: true
}
});
the above code is converted into:
var query = new breeze.EntityQuery().from('Customers').where(
breeze.Predicate.and(
new breeze.Predicate('country.code', '==', 'en-US'),
breeze.Predicate.or(
new breeze.Predicate('age', 'gt', 18),
new breeze.Predicate('name', 'contains', 'z')
)
)
)
.top(10)
.skip(5)
.orderBy('name desc')
.expand('country');