I’m working on a Python/MongoDB project in both my computer at home and my laptop.
The schema in document stores, naturally, is best represented by the data itself – and that’s why I want to distribute my test data over Mercurial, together with the code itself.
Would the best way be to simply dump the BSONs in a file and add it to the mercurial repository?
Dumping BSON and putting it into a VCS would not make much sense, since it’s binary file and can’t be viewed easily.
You can export a collection to a JSON, by using
mongoexporttool. You can even pass it a query filter to limit number of exported documents.Here’s an example (reformatted for readability):