Hi there - we're using the following:
- Loopback 3.0 (with the Postgresql connector)
- Node v6.12.3
..and an Angular front end.
I'm trying to retrieve both the count of records between two dates and the records that also fall between these dates.
If I call* the API 'count' endpoint with this URL:
..I get a count of the items within that date range and I see this in the debug console:
- loopback:connector:postgresql SQL: SELECT count(*) as "cnt" FROM "public"."sasdevices" WHERE "first_conn" BETWEEN $1 AND $2
- loopback:connector:postgresql Parameters: ["2018-04-01","2018-04-09"]
And I get a valid count of the records between those dates, which is everything I would expect.
However, if I call the 'find' endpoint with the same parameters, like either of these:
..then the debug console shows this:
- loopback:connector:postgresql SQL: SELECT (list of fields) FROM "public"."sasdevices" ORDER BY "deviceid"
...and then tries to return all 2 million+ records, crashing the server. Less than ideal.
I've also tried the JSON formatted requests from Postman and discovered that while this doesn't work:
..this request does:
But if I add the '["where":' to the request in the code, I get an error that the dates could not be processed.
Why is the 'find' endpoint not honouring the dates provided?
(* Doesn't matter if I use code, the Loopback API Explorer or Postman, the results are the same.)