dadi/web

Datasource module mangles Mongo aggregation queries

jimlambie opened this issue · 0 comments

If sending an array of MongoDB pipeline stages as the filter to API, Web attempts to turn it into an object using Object.assign.

Suggestion:

lib/datasource/index.js

- this.originalFilter = Object.assign({}, this.schema.datasource.filter)
+ this.originalFilter = Array.isArray(this.schema.datasource.filter) ? Array.from(this.schema.datasource.filter) : Object.assign({}, this.schema.datasource.filter)