eherve / mongoose-datatable

Server side dataTable request support for mongoose
MIT License
42 stars 28 forks source link

Not working with __ttl document expiration via mongoose-ttl plugin #50

Open k00k opened 8 years ago

k00k commented 8 years ago

I have been using mongoose-datatable for a long time without any problems (great plugin, thanks!).

However, today I added a __ttl (document expiration) by using the mongoose-ttl plugin. I use this by first defining my schema as normal, and then invoking the plugin: schema.plugin(ttl, { ttl: '90d' });

The problem that started happening is that even though I get data back via dataTables, it says: recordsTotal: 0, recordsFiltered: 0,

Is there a known issue when working with other plugins or the mongoose-ttl one in particular?

And here's a pastie of my debug output:

http://pastebin.com/eq3avEdh

eherve commented 7 years ago

Hi,

The plugin ttl is adding test to request like count, aggregate... : `model.count({ ttl: { '$gt': new Date("Wed, 22 Feb 2017 21:32:57 GMT") } }) {}`

mongoose-datatable module can be affected by plugins that modify request to the db such as __ttl.

eherve commented 5 years ago

To be tested with version 2.0.0: npm install --save git+ssh://git@github.com/eherve/mongoose-datatable.git