Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

225
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda