【问题标题】:Uncaught exception: Reference error: Db is not defined未捕获的异常:引用错误:未定义 Db
【发布时间】:2021-11-13 20:30:50
【问题描述】:

我是 MongoDb 的新手,我正在尝试使用命令行界面与数据库进行交互。但是,我面临错误未捕获的异常。谁能帮我解决这个问题?

> show dbs
Organization  0.000GB
admin         0.000GB
config        0.000GB
local         0.000GB
> Organizations.dropDatabase()
uncaught exception: ReferenceError: Organizations is not defined :
@(shell):1:1
>

感谢您的帮助

【问题讨论】:

  • 请不要粘贴截图,使用格式化文本。见meta.stackoverflow.com/a/285557/3027266
  • 感谢您的建议。更新了问题。如果可能的话,你能帮我检查一下吗?提前致谢

标签: database mongodb shell exception command


【解决方案1】:

看看dropDatabase 是如何工作的。

> use Organizations
> db.dropDatabase()

【讨论】:

    【解决方案2】:

    试试这个:

    use Organizations
    db.dropDatabase()
    

    db.getSiblingDB("Organizations").dropDatabase()
    

    【讨论】:

      猜你喜欢
      • 2013-10-27
      • 2011-09-25
      • 2021-11-01
      • 2017-11-22
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多