ForestAdmin / forest-express-mongoose

🌱 ExpressJS/Mongoose agent for Forest Admin to integrate directly to your existing ExpressJS/Mongoose backend application.
https://www.forestadmin.com
GNU General Public License v3.0
193 stars 28 forks source link

[*] Charts - Data filters not applied #248

Closed JoepDriesen closed 4 years ago

JoepDriesen commented 5 years ago

Expected behavior

When applying filters in charts in the dashboard or when searching for data in the Data tab, the data is correcty filtered

Actual behavior

The filters are not being applied and instead all data is shown

Failure Logs

No error logs found in console

Capture

Context

TODO: Please provide any relevant information about your setup.

arnaudbesnier commented 5 years ago

Hi @JoepDriesen, Thanks for your feedback.

I cannot reproduce so far with the same kind of filter conditions.

Screenshot 2019-10-28 at 08 22 33

Could share with us the logs of your server for the broken charts to see if those conditions are well transmitted and if the query looks good?

JoepDriesen commented 4 years ago

Hi,

Thanks for responding. We have downgraded our forest liana package to 3.x for the past few months, so didn't really look into this issue anymore. However, we would like this resolved now because of the new features and bugfixes :).

I have upgraded our QA environment again to "forest-express-mongoose": "^5.4.0"

The issue is only happening in our Azure environment. Local development environment seems to apply the filters correctly.

Also, this is not only an issue with the dashboard charts. It is the same issue anywhere filters are applied (i.e. when searching records with filters in the Data tab).

I have inspected the mongoDB log, and it appears the filters are not being sent correctly to mongodb:

This is a log record from mongodb after I search our "Result" collection with a filter:

{ "op" : "query", "ns" : "buffl-qa.results", "command" : { "find" : "results", "filter" : { }, "projection" : { }, "limit" : 10, "returnKey" : false, "showRecordId" : false, "lsid" : { "id" : UUID("73636803-b62a-475f-ac0e-ed253c375079") }, "$db" : "buffl-qa" }, "keysExamined" : 0, ... }

As you can see, the filter is empty. The server log show the filter arrives correctly to the forest endpoint:

2019-12-03T10:45:52.414051658Z ::ffff:172.16.1.1 - - [03/Dec/2019:10:45:52 +0000] "GET /forest/Result/count?fields%5BResult%5D=_id%2Ccampaign%2Cuser%2Ccomplete%2Cdeleted%2CcreatedAt%2Ccustom_client_identifier&fields%5Bcampaign%5D=name&fields%5Buser%5D=email&filters=%7B%22field%22%3A%22campaign%3Alanguage%22%2C%22operator%22%3A%22equal%22%2C%22value%22%3A%22Dutch%22%7D&searchExtended=0&timezone=%2B01%3A00 HTTP/1.1" 304 - "https://app.forestadmin.com/34771/data/1379457/index?filterType=and&campaign:language[0][val]=Dutch&campaign:language[0][op]=is" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0"

So as far as I can tell, something must be going wrong in the forest liana... I'm not sure where to look next. Any suggestions?

Thanks!

JoepDriesen commented 4 years ago

Hi,

We have resolved this issue.

Somehow a stale node_modules folder was present in our build directory on the azure server. This seemed to cause forest to use these outdated packages somehow.

After deleting this folder, everything works as expected.