mongoose-datatable icon indicating copy to clipboard operation
mongoose-datatable copied to clipboard

Not working with __ttl document expiration via mongoose-ttl plugin

Open k00k opened this issue 8 years ago • 2 comments

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

k00k avatar May 24 '16 16:05 k00k

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 avatar Feb 22 '17 21:02 eherve

To be tested with version 2.0.0: npm install --save git+ssh://[email protected]/eherve/mongoose-datatable.git

eherve avatar Mar 05 '19 09:03 eherve