MongoDB is a document database designed for performance and scale while remaining easy for developers to use. MongoDB provides two features that can be considered groundbreaking. First, it works with native language types, so the database works for you rather than you having to conform to it. It feels so natural to simply save arrays or objects that you’ll quickly forget you are using a database. Second, the schema is totally flexible meaning that each record can contain different fields.
People and phone numbers
Lorna Jane Mitchell and Steve Francia can create people in their address book and associate different kinds of data with different people, then store this in MongoDB using PHP. First they create the array of data, which should be fairly familiar even if PHP isn’t your native language. Then they create a connection to the MongoDB database by creating a new Mongo object. The PHP libraries for handling MongoDB are robust and approachable, and have really excellent documentation; by default the new Mongo object will simply connect to the MongoDB server on localhost but they can pass additional parameters if they needed to configure this for another target database.
Comments
Be the first to write a comment
You must me logged in to write a comment.