Mongodb – How do i copy the mongodb data-files to mongodb server

mongodb

I actually copied above two files in MongoDB's data folder which is default in windows machine (C:\data\db ). But when I start mongo shell and type show dbs, it will not show my database.

Steps I followed is as below.

1. copy the data files to C:\data\db
2. start the MongoDB server by mongod --dbpath C:\data\db
3. start the MongoDB shell by mongo command in command prompt
4. type show DB's command to list the databases

But I am not able to see my databases. Any help would be appreciated.

Thanks, Krishna

Best Answer

With MMAPv1 you could copy f.ex. local.* files to some new mongod instance and instance saw those. With wiredTiger, you cannot do it anymore.