I have a simple model object with startDate and endDate properties.
I can not seem to query with both 'and/or' and 'between' using the REST api. I would like to query 'between' a startDate range 'or' an endDate range. I would have thought that the following query would have worked:
?filter[where][or][0][event.startDate][between][0]=2017-01-15&filter[where][or][0][event.startDate][between][1]=2017-01-22&filter[where][or][1][event.endDate][between][0]=2017-01-15&filter[where][or][1][event.endDate][between][1]=2017-01-22
Ideally I would have liked to query between event.startDate and event.endDate but loopback does not like the following query:
?filter[where][event.startDate][between][0]=2017-01-15&filter[where][event.endDate][between][1]=2017-01-22
The queries work independently just fine:
?filter[where][event.startDate][between][0]=2017-01-15&filter[where][event.startDate][between][1]=2017-01-22
?filter[where][event.endDate][between][0]=2017-01-15&filter[where][event.endDate][between][1]=2017-01-22
Here is my model definition:
models/event.json
{
"name": "event",
"plural": "events",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"name": {
"type": "string",
"required": false
},
"startDate": {
"type": "date",
"required": false
},
"endDate": {
"type": "date",
"required": false
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}