Monthly Archives: May 2016

How to Export Mongo collection without mongoexport command

As we know we can export mongo collection or mutliple collections using mongoexport command
but sometime you don’t have access for mongoexport command for given user.
So you can export mongo collection without using mongoexport command as below.
1. Rurn following command in shell

mongo | tee collection.json

2. And then run following command


3. Now open file collection.json file and remove extra lines from file(like use db statements etc or command itself)
from start and end of file