mongodb-backup icon indicating copy to clipboard operation
mongodb-backup copied to clipboard

Support for `mongodump` like output

Open IstoraMandiri opened this issue 10 years ago • 4 comments

I was wondering whether it would be possible to transform the output to mongodump-like output.

The benefit of this is that you can use mongorestore on the CLI if you wanted to restore to a database created using mongodb-backup, and similarly, it's be cool if mongodb-restore had the ability to read a normal mongodump folder.

This is what mongodump spits out

collectionA.bson
collectionA.meta.json //this file is not required but contains index data
collectionB.bson
collectionB.meta.json
...

And this is what mongodb-backup currently creates

collectionA/
  _idA.bson
  _idB.bson
collectionB/
  _idC.bson
  _idD.bson
...

Would it possible to add directional compatibility for mongodump and mongorestore by implementing this transformation?

IstoraMandiri avatar Sep 18 '15 12:09 IstoraMandiri

cool idea it's a breaking change, but can be very useful!

however, if you need a *cli command, you can use mongodb-backup-cli and mongodb-restore-cli for the moment

hex7c0 avatar Sep 18 '15 20:09 hex7c0

Needn't be breaking! nativeOutput: true and nativeInput: true would work?

IstoraMandiri avatar Sep 19 '15 18:09 IstoraMandiri

yes sure! for the moment output remains the same maybe (in the future) will be default

hex7c0 avatar Sep 21 '15 18:09 hex7c0

@hitchcott If its still relevant my own solution for mongodb backup creates backup that is compatible with the native mongodump you can basically use mongorestore to restore backups created by my library. will appreciate contribution! https://github.com/lihaibh/mongodb-snapshot

lihaibh avatar Sep 07 '20 03:09 lihaibh