This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am a MongoDB newbie trying to understand this database.
If collections are not schema-fixed, that is, if documents can vary with regard to number and kind of field, why would one ever have more than 1 collection per database? What is the advantage of having multiple collections in one database?
Collections are analogous to tables in a relational DB. So you would store similar/related data structures in a collection, perhaps with nested documents to replace relational joins and foreign keys. You can store documents with different attributes in the same collection, but you would still be wanting to have some logical consistency across your collection e.g all Customer details in one collection.
But putting all your data in one collection would be like putting it all in one table. You need the extra layer of abstraction to organise your data sensibly, index things correctly, and so on. Also, a single document (analogous to a record in an RDBMS) cannot be more than 16MB in Mongo, which is fine for many purposes but probably not if you're trying to squeeze your whole database into one collection. When you are querying data, you try to ensure that the data (or at least the indexes) for your working set will fit into RAM to minimise disk I/O, which will be hard to achieve if every query has to trawl through your entire database in a single collection.
If you want to find out more about MongoDB, I can highly recommend the free online courses from 10Gen. Check them out at http://education.10gen.com.
PS: I'm really psyched up about MongoDB cos I just attended the great MongoDB Days 2013 conference today in London. :-)