Is there any possibility in MongoDB java driver to make backUp and restore DB?
My solution (just execute command) for now:
public void makeBackUp(String path) {
try {
Runtime.getRuntime().exec("mongodump --out " + path);
} catch (IOException ex) {
Logger.getLogger(MongoDB.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void restore(String backUpPath) {
try {
Runtime.getRuntime().exec("mongorestore " + backUpPath);
} catch (IOException ex) {
Logger.getLogger(MongoDB.class.getName()).log(Level.SEVERE, null, ex);
}
}
Thanks in advance.