I am using Breeze.js in my project and the following query returns me all the group entities that I have in local cache although only one of them has group==group
breeze.EntityQuery.from('Groups').using(manager).where('group', '==', 'group').executeLocally();
Here my metadata definition:
{
"shortName": "Group",
"namespace": "CM.Models",
"baseTypeName": "Entity",
"autoGeneratedKeyType": "Identity",
"defaultResourceName": "Groups",
"dataProperties": [
{
"name": "groupID",
"dataType": "String",
"maxLength": 32,
"defaultValue": "",
"validators": [
{
"name": "maxLength",
"maxLength": 32
}
]
},
{
"name": "group",
"dataType": "String",
"maxLength": 32,
"defaultValue": "",
"validators": [
{
"name": "required"
},
{
"name": "maxLength",
"maxLength": 32
}
]
},
{
"name": "groupMembers",
"dataType": "String",
"isScalar": false,
"defaultValue": []
}
]
}
Is it a bug of Breeze.js?
For reference, I found the answer after digging into breeze.js code. It turns out that it is possible to escape the evaluation side. Therefore the query becomes:
breeze.EntityQuery.from('Groups').using(manager).where('group', '==', "'group'").executeLocally();
"'group'" insetad 'group'