How to recover a dropped MongoDB database?

后端 未结 2 1420
自闭症患者
自闭症患者 2020-12-11 07:02

If somebody accidentally dropped a MongoDB database but executing db.dropDatabase(), how can he recover the database?

Dropping a database in MongoDB is simple, and t

2条回答
  •  渐次进展
    2020-12-11 07:30

    I tried to reproduce what you had done. I killed a database using db.dropDatabase() after I had backed it up :-) The db name was 'gacheater'. Before dropping mongodb folder contained 3 files (the db is non-empty):

    • gacheater.ns
    • gacheater.1
    • gacheater.2

    after dropping these files disappeared. Therefore I think mongodb really removes your data.

    So the only choice you have is to try to restore files from the filesystem

    PS: MacOS 10.5, MongoDB 1.8.2

提交回复
热议问题