Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

362
Vistas
My mongodb collection got dropped. How can I see what happened?

I have a collection that is alimented automatically to simulate user input. I used to have 32000+ documents in it, now only 2000. My collection was dropped some time yesterday and I don't know what happened.

Luckily, there is a timestamp on every document, so I can see exactly when it happened. (The oldest document in only a day old, there are new ones every 2 minutes.) How can I see what happened ?

It was likely done by a script, so it doesn't appear in .dbshell, which is capped to 99 lines anyway. Is there a history of anything done to the base, not just manually ?

Is there a way to know what caused this ?

Extra info: I'm the only one with access to the base for now, and I have only one script that can drop my tables, I haven't touched it in ages.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Check this Answer https://stackoverflow.com/a/15204638/4996928 on StackOverflow

I ended up solving this by starting mongod like this (hammered and ugly, yeah... but works for development environment):

mongod --profile=1 --slowms=1 &

This enables profiling and sets the threshold for "slow queries" as 1ms, causing all queries to be logged as "slow queries" to the file:

/var/log/mongodb/mongodb.log

Now I get continuous log outputs using the command:

tail -f /var/log/mongodb/mongodb.log

An example log:

Mon Mar  4 15:02:55 [conn1] query dendro.quads query: { graph: "u:http://example.org/people" } ntoreturn:0 ntoskip:0 nscanned:6 keyUpdates:0 locks(micros) r:73163 nreturned:6 reslen:9884 88ms
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda