I have a mongodb instance running at localhost:27017
Then I imported the below grades.json into mongo database 'backend' by
mongoimport --db backend --collection grades --drop --file ./grades.json
Next I created a feathers application called 'backend' by
feathers generate app
Then created a service called 'grades', configured as 'mongoDB' and set the db link to 'localhost:27017/backend' by
feathers generate service
Start the app by npm start
at localhost:3030
Used postman to request localhost:3030/grades and got all the records
However when I tried to use localhost:3030/grades?grade[$lt]=90
, it returned 0 records.
Even when requesting localhost:3030/grades?grade=90
it fails.
My attempt: I tried adding a 'before' hook to service 'grades' as:
function(context) {
const query = context.params.query;
if (query.grade !== undefined) {
context.params.query.grade = parseInt(query.grade);
}
}
This makes localhost:3030/grades?grade=90
work, however the filtering by $lt still doesn't work.