I'm using a real Mongo instance for my integration tests. On every test, I call mongorestore my_db_state --drop because I need a clean db to start the next test.

On my tiny db (with only one test user account) it takes 180 ms to run mongorestore my_db_state (without --drop) and 455 ms with --drop.

I don't understand why it's taking so long to drop the db, but how can I speed this up?

I may have a bunch of different connections on the mongo server because I never close them on my Flask server, but they probably should be closed after the test is over...just not sure if this is an issue to care about.

Is there a faster way to restore a snapshot to its original state for testing purposes?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.