Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
Mongodb collections are dropped automatically

I have MongoDB database setup in a Linux server along with a tomcat and everything works great. But i noticed that every 2 or 4 days the whole database collections are dropped. I saw the log of the MongoDB:

Mon Jan 16 08:01:14.375 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 11ms
Mon Jan 16 08:01:14.404 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 12ms
Mon Jan 16 08:01:18.402 [TTLMonitor] query PLEASE_READ.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:1 keyUpdates:0 locks(micros) r:104348 nreturned:0 reslen:20 104ms
Mon Jan 16 08:25:03.640 [initandlisten] connection accepted from 95.211.153.138:58622 #135 (7 connections now open)
Mon Jan 16 08:25:04.286 [conn135] dropDatabase PLEASE_READ starting
Mon Jan 16 08:25:04.287 [conn135] removeJournalFiles
Mon Jan 16 08:25:04.490 [conn135] dropDatabase PLEASE_READ finished
Mon Jan 16 08:25:04.508 [conn135] command PLEASE_READ.$cmd command: { dropDatabase: 1.0 } ntoreturn:1 keyUpdates:0 locks(micros) W:246737 reslen:62 246ms
Mon Jan 16 08:25:04.579 [conn135] dropDatabase server_db starting
Mon Jan 16 08:25:04.579 [conn135] removeJournalFiles
Mon Jan 16 08:25:04.686 [conn135] dropDatabase server_db finished
Mon Jan 16 08:25:04.686 [conn135] command server_db.$cmd command: { dropDatabase: 1.0 } ntoreturn:1 keyUpdates:0 locks(micros) W:107150 reslen:60 107ms
Mon Jan 16 08:25:04.756 [conn135] dropDatabase local starting
Mon Jan 16 08:25:04.756 [conn135] removeJournalFiles
Mon Jan 16 08:25:04.780 [conn135] dropDatabase local finished
Mon Jan 16 08:25:04.850 [conn135] dropDatabase admin starting
Mon Jan 16 08:25:04.850 [conn135] removeJournalFiles
Mon Jan 16 08:25:04.852 [conn135] dropDatabase admin finished
Mon Jan 16 08:25:04.922 [conn135] dropDatabase test starting
Mon Jan 16 08:25:04.922 [conn135] removeJournalFiles
Mon Jan 16 08:25:04.926 [conn135] dropDatabase test finished
Mon Jan 16 08:25:05.139 [conn135] allocating new ns file /var/lib/mongodb/WARNING.ns, filling with zeroes...
Mon Jan 16 08:25:05.502 [FileAllocator] allocating new datafile /var/lib/mongodb/WARNING.0, filling with zeroes...
Mon Jan 16 08:25:05.537 [FileAllocator] done allocating datafile /var/lib/mongodb/WARNING.0, size: 64MB,  took 0.009 secs
Mon Jan 16 08:25:05.547 [FileAllocator] allocating new datafile /var/lib/mongodb/WARNING.1, filling with zeroes...
Mon Jan 16 08:25:05.567 [conn135] build index WARNING.WARNING { _id: 1 }
Mon Jan 16 08:25:05.569 [FileAllocator] done allocating datafile /var/lib/mongodb/WARNING.1, size: 128MB,  took 0.021 secs
Mon Jan 16 08:25:05.592 [conn135] build index done.  scanned 0 total records. 0.023 secs
Mon Jan 16 08:25:05.653 [conn135] insert WARNING.WARNING ninserted:1 keyUpdates:0 locks(micros) w:492848 513ms

I don't use a TTL index to any of the collections and i don't run any script in Linux to drop the database.

My question is why the collections are dropped? Is it cause of the TTL?

Thank you.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

mongodb cannot auto remove collections but it can auto remove BSON records. You just need to set ttl(Time to live) index on a date field that exists in BSON record . You can read more here

https://docs.mongodb.com/manual/tutorial/expire-data/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!