If you download a compose.io backup of a mongodb instance and uncompress the .tar file you end up with .ns
and extensions that are single digits. How do you restore the db from these?
Asked
Active
Viewed 3,542 times
13

Shwaydogg
- 2,499
- 27
- 28
1 Answers
16
The .ns .0 .1 etc. files are the data files themselves.
This the raw db you can mongodump
those files and then mongorestore as always:
This solution would work pre mongo 3.0, but --dbpath is no longer supported
by mongodump
.
Mongo 3.0 Solution:
- Run
mongod --dbpath ./
from the directory with the extracted download with the.ns
files. - Run
mongodump -d [DBNAME] -o [DIR TO DUMP TO]
...options are not required. - Proceed with a mongorestore as normal

Shwaydogg
- 2,499
- 27
- 28
-
I've got a post here explaining how to do this in detail: https://dhariri.com/posts/570275fed1befa596a80bba2 – David Hariri Apr 06 '16 at 19:51
-
So what would be the solution for MongoDB 3.x? – user3072843 Aug 28 '17 at 08:43
-
@user3072843 The above solution worked for Mongo 3.4. – Sean Oct 03 '19 at 20:44