Every developer has the same nightmare. Someone runs a command on the wrong database, a collection gets dropped, and suddenly the data is just gone. Your last backup was from midnight, so you can restore that, but you still lose everything that happened after midnight.
I wanted something better. Not just "restore last night's backup" but "restore the database to the exact second before the drop happened." That feature has a name: point-in-time recovery, or PITR. This post is about how I built it, and the one small MongoDB fact that makes the whole thing possible.
The project is open source and called mongopit. You can find it here:
https://github.com/takiuddinahmed/mongopit
The core problem






