admin管理员组文章数量:1394526
I can run db.repairDatabase() from the mongodb shell but I can't find an example on running the same mand from node.js app using the mongodb-native module. How can I run "repairDatabase" with executeDbCommand method?
I can run db.repairDatabase() from the mongodb shell but I can't find an example on running the same mand from node.js app using the mongodb-native module. How can I run "repairDatabase" with executeDbCommand method?
Share Improve this question asked Feb 19, 2012 at 22:25 stradastrada 9429 silver badges18 bronze badges2 Answers
Reset to default 9db.mand({repairDatabase:1}, function(err, result) {
});
If you want to see what the mongo javascript shell does, just remove the parenthesis and it will show you the underlying code:
> db.repairDatabase
function () {
return this._dbCommand({repairDatabase:1});
}
//This basically...
>return this.getCollection("$cmd").findOne({repairDatabase:1});
See this code in the driver for the implementation.
本文标签: javascriptRunning dbrepairDatabase() from mongodbnative in nodejsStack Overflow
版权声明:本文标题:javascript - Running db.repairDatabase() from mongodb-native in node.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744094082a2589960.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论