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

前端 未结 4 1327
臣服心动
臣服心动 2020-12-21 12:52

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

4条回答
  •  [愿得一人]
    2020-12-21 13:40

    Well as of now, Mongo Java driver does not support this.

    You can try invoking the mongoimport and mongorestore commands from Java Runtime. Like

    Runtime.getRuntime().exec("mongoimport -d  -h <>..");
    

提交回复
热议问题