Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find the executed TTL commands in Mongo DB

Tags:

mongodb

ttl

I would like to know the logs of documents removed through TTL indexing. I tried using db.setProfileLevel(2) and searched the db.system.profile.find({op:"remove"}).pretty(), but It returned nothing.

Can you please let me know the location of documents (kind of IDs etc) which are automatically removed using the feature TTL MongoDB?

like image 331
user4604434 Avatar asked Feb 26 '15 07:02

user4604434


1 Answers

From the manual Expire Data from Collections by Setting TTL

When the TTL thread is active, you will see a delete operation in the output of db.currentOp() or in the data collected by the database profiler.

so try to use delete instead od remove in the query.

like image 55
user854301 Avatar answered Nov 15 '22 04:11

user854301