不存在但在连接中显示的 Mongo db [英] Mongo db that does not exist but shows up in connection

查看:68
本文介绍了不存在但在连接中显示的 Mongo db的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我删除了一个名为test"的 MongoDB 数据库,但是当我连接到 mongod 时,它会在连接中显示它.请看下面的代码.你能帮我理解发生了什么吗?这是一个错误还是我遗漏了什么?为什么在使用 show dbs 命令时 test 不在数据库列表中.感谢您的帮助.

I have dropped a MongoDB database called 'test' but when I connect to mongod it shows it in the connection. Please see the code below. Can you please help me understand what is going on? Is this a bug or I am missing something? Why is it that test is not in the list of databases when using show dbs command. Thanks for the help.

Microsoft Windows [版本 6.1.7601]版权所有 (c) 2009 Microsoft Corporation.保留所有权利.

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Me>c:\mongodb\bin\mongo

C:\Users\Me>c:\mongodb\bin\mongo

MongoDB shell 版本:2.4.8

MongoDB shell version: 2.4.8

连接到:测试

数据库

测试

显示数据库

本地 0.078125GB

local 0.078125GB

>

推荐答案

你的 show dbs 输出只有一个 db,local,它是自动创建的.如果您在启动时没有指定数据库,mongo shell 默认为 test,这就是您看到connecting to: test"的原因.直到您开始将数据插入其中的集合中,才会创建数据库 test.

Your show dbs output only has one db, local, which is created automatically. If you don't specify a database on startup the mongo shell defaults to test which is why you see "connecting to: test". The database test will not be created until you start inserting data into a collection in it.

这篇关于不存在但在连接中显示的 Mongo db的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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