为什么在使用Studio3T连接MongoDB时会出现一个名为”test”的数据库?

huangapple go评论91阅读模式
英文:

Why is there a database named "test" when connecting MongoDB using Studio3T?

问题

我正在学习 MongoDB 并尝试使用 Atlas。我创建了一个远程集群,并尝试使用 MongoDB Compass 和 Studio 3T 连接它。然而,我注意到在使用 Studio 3T 连接后,左侧面板中出现了一个名为 "test" 的空数据库,位于 "admin" 和 "local" 数据库下方。它是从哪里来的?我该如何删除它?因为当我尝试删除这个数据库时,出现了以下错误:

Mongo 服务器错误(MongoCommandException):命令执行失败,错误代码为 8000(AtlasError):'user is not allowed to do action [dropDatabase] on [test.]',在服务器 ac-bkmhuxm-shard-00-02.w2nutv2.mongodb.net:27017 上。

完整的响应如下:
{
"ok" : 0.0,
"errmsg" : "user is not allowed to do action [dropDatabase] on [test.]",
"code" : 8000.0,
"codeName" : "AtlasError"
}

在 Atlas 中更改角色后,我现在可以删除这个数据库。然而,每当我建立新的与 MongoDB 的连接时,它仍然出现。为什么会这样?

英文:

I'm learning MongoDB and trying to use Atlas. I created a remote cluster and tried to connect it using both MongoDB Compass and Studio 3T. However, I noticed that after connecting with Studio 3T, there was an empty database named "test" appearing in the left panel, below "admin" and "local" databases. Where did it come from? And how can I drop it? Because when I tried to drop this database, I got this error

    Mongo Server error (MongoCommandException): Command failed with error 8000 (AtlasError): 'user is not allowed to do action [dropDatabase] on [test.]' on server ac-bkmhuxm-shard-00-02.w2nutv2.mongodb.net:27017. 

The full response is:
{
    "ok" : 0.0,
    "errmsg" : "user is not allowed to do action [dropDatabase] on [test.]",
    "code" : 8000.0,
    "codeName" : "AtlasError"
}

After changing the roles in Atlas, I can now delete the database. However it keeps appearing when I make a new connection to MongoDB. Why is that?

答案1

得分: 1

数据库 test 是默认数据库,当你没有定义任何内容时使用。

数据库 localadminconfig 是MongoDB系统内部数据库,除非得到MongoDB支持或特殊管理员任务的建议,不应该操作它们。

另请参阅 MongoDB中的3个默认数据库

英文:

Database test is the default database when you don't define anything.

Databases local, admin and config are MongoDB system internal databases, you should not touch them unless advised by MongoDB support or special admin tasks.

See also 3 default database in MongoDB

huangapple
  • 本文由 发表于 2023年2月8日 17:55:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75384032.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定