Book Image

Practical Web Development

By : Paul Wellens
Book Image

Practical Web Development

By: Paul Wellens

Overview of this book

Table of Contents (23 chapters)
Practical Web Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
10
XML and JSON
Index

MongoDB


With MongoDB, we just replace MySQL with a document database that can be a better solution for our projects and has JSON as the common denominator. MongoDB uses collections and documents. So, that makes it more suitable for, for example, an online bookstore application.

As a document in MongoDB is a JSON object, to transfer data to it from PHP is as simple as storing the data in a PHP array. No more multiple tables and inner joins required. We will explain how to get to MongoDB, create a database, and add and update documents. We will do so from within a PHP program, as well as the MongoDB shell.

Installing MongoDB

Obtaining and installing MongoDB depends on the platform you are using. Go to www.mongodb.org for the software and the documentation. This will get you basically two programs. The first one is mongod (known as the MongoDB daemon), a program that needs to be up and running all the time, just like a MySQL server would. The second one is simply called mongo and it is the MongoDB...