1

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

>

RahimiSK
  • 13
  • 1
  • 4
  • 2
    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. – Stennie Jan 05 '14 at 02:28
  • Why not make that an answer ? all is said. – Calimero Jan 05 '14 at 08:39
  • That is a great explanation. I understand what is going on now. As a newbie to Mongo, I guess I have a lot to learn - Thanks Stennie. – RahimiSK Jan 06 '14 at 00:17

1 Answers1

6

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.

Stennie
  • 63,885
  • 14
  • 149
  • 175