PHP Classes

Very good first step

Recommend this page to a friend!

      MongoDB and PHP  >  All threads  >  Very good first step  >  (Un) Subscribe thread alerts  
Subject:Very good first step
Summary:MongoDB and PHP is a good first step to learn MongoDB
Author:Alberto Castro
Date:2015-07-30 15:40:15
Update:2015-07-30 21:18:41

  1. Very good first step   Reply   Report abuse  
Picture of Alberto Castro Alberto Castro - 2015-07-30 21:18:41
As a PHP programmer (primarily) I found the book easily accessible and very well written and I would recommend it to anyone that wants to start learning MongoDB. I would add though that if you want to use MongoDB in a production environment a lot more is needed.

The main difference between programming to connect to a MySQL and MongoDb is that 99% of the time MySQL is used in a single server configuration, whereas MongoDB is used 99% in a cluster configuration. The cluster may have replica sets and shards and may be geographically distributed. So questions of from where to read and where to write are not obvious. MongoDB abstracts a lot of this but knowing the implications of the programming decisions is fundamental in a production environment.

Several important topics such as write concerns are not explained in sufficient detail. MongoDB basic production set up is a replica set with 3 servers (one of which may not hold data). Journaling should be enabled as well in production. All those characteristics make the system much more complex since data will not be written at the same time in all the servers.

A very good book to learn about MongoDB and programming with it is "MongoDB the Definitive Guide" by Kristina Chodorow, even though it does not use PHP it is very easy to rewrite the Python or JavaScript of the book into PHP. I would recommend it to anyone that wants to seriously pursue MongoDB as a production alternative. There are free courses in ( and many other resources.

So my recommendation would be to start with MongoDB and PHP and stop there if you just want to understand the document based model and the basics of programming in MongoDB with PHP.

Then continue with MongoDB the definitive guide if you want more details or want to set up a production environment.

All this is not to say the MongoDB and PHP is a bad book, on the contrary, it is an excellent introduction to MongoDB and I recommend it to anyone that wants to start learning this database system.