Search code examples
javamongodbmongodb-java

How to import/export all collections of the MongoDB database using mongodb java driver?


Is there any function to import and export all collections of mongodb database using java driver.? like there is mongodump and mongorestore using command prompt.


Solution

  • The short answer is no. These commands can be invoked only from command line. You might consider to fetch all the data from all collections but its expected to be slow.

    You can read a discussion around this here.