Converting files from MongoDB 1.8

I have a few files from /data/db - database created with MongoDB1.8 over 5 yrs ago. The format is:
olddb.1
olddb.2
olddb.3
olddb.4
olddb.ns

Any way to convert it to a new format without recreating the old environment to do proper migration?

1 Like

Welcome to the MongoDB community @Tyra_M!

MongoDB 1.8 was released almost 10 years ago (March, 2011) and there have been significant changes since then. There have been several changes in the on-disk MMAP format since 1.8, and I’m not sure how far you can stretch backward compatibility.

What is your desired goal state? For example, do you want your data to end up in the latest version of MongoDB server or are you just trying to extract some data from an old backup?

A few approaches to consider (make sure you test with a copy of your data files):

  • Try installing MongoDB 4.0.x (the last version supporting the MMAP storage engine) with a dbPath pointing to a copy of your database files. There may be too many changes for this to succeed, but I think is worth trying.

  • Install an older version of MongoDB server which is closer (by major release version) to your original data files, take a backup using mongodump, and then mongorestore that to a current version of MongoDB server. I think MongoDB 2.2.x would be a reasonable starting point (and it included some useful mongodump improvements like backing up index definitions).

If you do end up trying one of these approaches (or a different one), please comment with the outcomes (successful or otherwise).

Regards,
Stennie

For fun I created a 1.8 database, 2 collections 40000 docuemts, very simple ({id: int})

Running 4.0 with the datafiles did not result in a db with the 1.8 collections present.

Stepping back major versions 3.0(also 2.2) seems to load it okay. So @Tyra_M to follow @Stennie_X’s 2nd point you should be able to get your data from 1.8 data files and into a newer vaerion.


Chris

2 Likes