mongodb admin/consoleコマンドをnode.jsからプログラムで実行する最良の方法は何ですか?具体的には、一連の挿入を実行した後でmongodumpを使用してmongodbコレクションをエクスポートしたいと考えています。このような何か:node.jsからプログラムでmongodumpコマンドを実行するにはどうすればよいですか?
// requires and initializing stuff left out for brevity
db.open(function(err, db) {
if(!err) {
db.collection('test', function(err, collection) {
var docs = [{'hello':'doc1'}, {'hello':'doc2'}, {'hello':'doc3'}];
collection.insert(docs, {safe:true}, function(err, result) {
// Execute mongodump in this callback???
});
});
}
});
うまく機能しました。ありがとう。 – TankofVines