• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New DB filling with zeroes

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 322
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 322
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Chris , I really appreciate it...
 
reply
    Bookmark Topic Watch Topic
  • New Topic