如何从命令行删除MongoDB数据库? [英] How do I drop a MongoDB database from the command line?

查看:87
本文介绍了如何从命令行删除MongoDB数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的bash提示中最简单的方法是什么?

What's the easiest way to do this from my bash prompt?

推荐答案

像这样:

mongo <dbname> --eval "db.dropDatabase()"

有关在此处从命令行编写Shell脚本的更多信息: https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/#scripting

More info on scripting the shell from the command line here: https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/#scripting

这篇关于如何从命令行删除MongoDB数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆