Question

We have recovered a MongoDB database from filesystem, but the WiredTiger.wt file has changed since then (i.e. the collection has been dropped).

So is it possible to read data (documents) from some .wt files without having the corresponding WiredTiger.wt?

Or create a WiredTiger.wt file with our own .wt files?

Was it helpful?

Solution

If you perform the recovery by overwriting some collection-*.wt files inside your dbpath, then your database is in an unsupported state. Data loss is quite likely in this case.

If you want to restore the database, you would need to restore the dbpath as a whole and not as individual files. Please see MongoDB Backup Methods for instructions and information on supported backup and restore methods.

The WiredTiger.wt file is a crucial metadata file that keeps track of the state of the whole database and all the *.wt files. Hence, the content of this file is deployment specific, and not transferrable to other deployments. It is not possible to recreate the content of this file.

If you have a known good backup of the whole dbpath, you may be able to restore to a valid state of the database, as long as you restore the dbpath as a whole.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top