I would love to see this come to exist too. My use case is that we have a massive production database with a large number of collections. We do not allow staff direct access to this database or its collections; only the application that interacts with it. Various staff need access to a small subset of very recent data, from only three of the collections, so our desired solution is to automate a mongodump that uses Views to extract only what they need, so that they can then import the daily dump into their own copy of Mongo and query as much as they like against it, with as poorly written a query as they feel like.
So in our case this would look like:
mongodump -d dbname --collection=view1 --collection=view2 --collection=view3 --viewsAsCollections --archive=/path/to/file
Since we can’t do this, we have to do three separate dumps, to three files, resulting in three imports. It would get worse the more collections (or views) you need.
1 Like