Reputation: 404
For example I have a model structure like the following:
{
"@odata.context": "serviceRoot/$metadata#People",
"@odata.nextLink": "serviceRoot/People?%24skiptoken=8",
"value": [
{
"@odata.id": "serviceRoot/People('russellwhyte')",
"Emails": [ "[email protected]", "[email protected]" ]
},
...
]
}
And I want to query all People who have "[email protected]" email in theirs email list. (Notice that the Emails is a collection of primitive type string.)
It seems like Breeze can only do smth like this, when dealing with collection of complex objects:
var query = EntityQuery.from("People")
.where("Email", "any", "fldname", "eq", "[email protected]");
Here "fldname" is a field that supposed to be inside the Email type.
But what if I want to compare primitive type like String and I don't have any field inside? In this case OData query would looks like the following:
$filter=Emails/any(s: s eq '[email protected]')
But is there any way to form this query using Breeze?
Upvotes: 2
Views: 1016
Reputation: 17863
Yes and no.
No, you can't compose it with the breeze query language which, AFAIK, doesn't understand filtering on a property that returns an array of strings.
But YES, you can send any URL to the server with a breeze query. If you can manually construct a URL that your OData server will interpret appropriately, go right ahead and send it.
var qUrl = "People/?$filter=Emails/any(s: s eq '[email protected]')";
var q = breeze.EntityQuery.from(qUrl);
manager.executeQuery(q).then(...).catch(...);
Upvotes: 1