“The Definitive Guide to MongoDB”

Just started reading this.

Looks like there are some useful chapters and sections, particularly:

3 The Data Model
4 Working with data
10 Optimisation
11 Replication
12 Sharding

“MongoDB is a new breed of database that has no concept of tables, schemas, SQL or rows. It doesn’t have transactions, ACID compliance, joins, FKs, or many of the other features…MongoDB is probably a very different DB to what you’re used to, especially if you’ve used an RDBMS in the past.”

“For many years, traditional relational DBs have been used for storing content of all types. It didn’t matter whether the data was a good fit for the relational model; the data was stuffed in there, anyway.”

“While using the DB as a storage bin works, developers always have to work against the flow. It’s usually obvious when we’re not using the DB the way it’s intended.” – usually results in multiple tables, multiple joins, complex and poor-nonperforming queries.

“MongoDB is not an ideal candidate for all situations…For example, its lack of transaction support means that you wouldn’t want to use MongoDB to write an accounting application..Once you’re comfortable with the idea that MongoDB may not solve all your problems, you will discover that there are certain problems that MongoDB is perfect for resolving, such as analytics (think a realtime Google Analytics for your website) and complex data structures (e.g blog posts and comments, Tweets).

“You don’t have to worry about squeezing your data into a table – just put the data together and pass it to MongoDB for handling.”

“Consider this real-world example. I needed to store a set of search results (up to 100) and I needed an easy way to associate the results with users in my DB.  Had I been using mySQL, I would have had to design a table to store the data (with potentially dozens of redundant columns), write code to insert the data, and then write code (joins) to piece it all back together again…In MongoDB I added this line of code:

request['search_results'] = search_results_array

In the preceding example,

request is my document
search_results is the key
search_results_array contains the results output

The second line saves my changes and writes to MongoDB.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s