Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New DB filling with zeroes

 
subodh kureel
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

MongoDB document says that db is not created till the time collection is added to it so I am curious that what is the meaning of below logs from mongod console , when context is set to new DB(mydb) . Does it mean that new DB is created with default collections ?

2015-01-11T22:02:52.352-0500 [conn1] allocating new ns file /usr/local/data/db/mydb.ns, filling with zeroes...
2015-01-11T22:02:52.392-0500 [FileAllocator] allocating new datafile /usr/local/data/db/mydb.0, filling with zeroes...
2015-01-11T22:02:52.509-0500 [FileAllocator] done allocating datafile /usr/local/data/db/mydb.0, size: 64MB, took 0.117 secs

Thanks
Subodh
 
Chris Barrett
Bartender
Posts: 317
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Subodh,

It has been a while since I reviewed the documents, but I believe the MongoDB documents say that a database will not be permanently created until you add data to it.
As such, a temporary database is defined as soon as a connection is established, or a database name is selected in the Mongo shell.
If you close the connection without adding any data, the temporary database will disappear.

Using the Mongo shell, you can see that with the show dbs command. No database in the name you chose will initially appear.
After you add data to that database, now that temporary database becomes permanent and the database you named will appear.

This way, MongoDB is automatically ready to go for data insertion as soon as a database name is chosen.

Cheers!
Chris
 
subodh kureel
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chris ...indeed document says "permanently"...looks like i missed that point.. thank you for your response.
 
Chris Barrett
Bartender
Posts: 317
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Subodh,

You are welcome! I'm happy I could clarify that.

I understand your confusion. I was confused the first time I looked at it, too.
They don't really do a good job of clarifying this "permanently" term, which I think is odd, as the setup process is very different from a traditional relationship database.

If you have any other questions, please don't hesitate to ask.

Cheers!
Chris
 
subodh kureel
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chris , I really appreciate it...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic