5

Environment
Windows Professional 10
MongoDB 3.6.4 2008R2Plus SSL (64 bit) (before computer crash)
MongoDB 4.0.2 2008R2Plus SSL (64 bit) (after computer crash)

I have been developing locally, and turned on computer today to blue screen of death.

I had no option but to reset Windows 10 and keep personal files.

I therefore have this directory:

C: > data

which contains two directories, db and log.

Below is contents of directory db:

enter image description here

Below is contents of directory log:

enter image description here

I have downloaded and installed:

MongoDB 4.0.2 2008R2Plus SSL (64 bit)

and I accepted the default installation directories:

enter image description here

Question

How can I restore the databases and collections from the contents of my original mongoDB data directory?

Note - I am on the same computer, after a Windows 10 reset, and new install of MongoDB.

Related Questions

There are similar questions below, but they don't seem to provide an authoritative and accepted answer:

How to restore .wt backup file to local MongoDB?

How to copy wt files from another mongo instance?

https://stackoverflow.com/q/37557319

https://stackoverflow.com/q/32551549

1 Answer 1

2

Some sort of benevolent magic occurred after doing the following:

Remove MongoDB Community Edition as a Windows Service, see here.

sc.exe delete MongoDB

Then when I went into my favourite MongoDB GUI (Robo3T), the databases were just there!

So i ran:

mongodump  

To get a "proper" dump of all my databases.

I'm confused how this could happen because the databases are still at their original location:

C:\data\

And the new MongoDB installation data location was:

C:\Program Files\MongoDB\Server\4.0\data\

¯_(ツ)_/¯

Atleast I have a proper mongodump backup now.

1
  • Its not working for me, please can help me in this, I dont get removing as service than how your Robo3T got connected to mongodb Apr 9, 2021 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.