Mongo db that does not exist but shows up in connection

女生的网名这么多〃 提交于 2019-12-11 13:16:02

问题


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 [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

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

MongoDB shell version: 2.4.8

connecting to: test

db

test

show dbs

local 0.078125GB

>


回答1:


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.



来源:https://stackoverflow.com/questions/20929203/mongo-db-that-does-not-exist-but-shows-up-in-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!