The PHP MongoDB Library Wiki

Or, everything you ever wanted to know about migrating from MySQL to MongoDB on your Apache/PHP Webserver(s)

Our Mission

The concept of either LAMP stack or MEAN stack is simplistic and should not be promoted. The M in LAMP can and should be MongoDB.

Lamp Gegen Mean

Robert Roose points out in his article LAMP vs MEAN Stack: Choosing the right stack for your startup that it doesn't have to be one or the other and that the database in LAMP doesn't necessarily have to be MySQL. The PHP MongoDB Wiki encourages all LAMP stack developers to adopt the long term goal of ditching MySQL for MongoDB to free up time for real application development instead of spending unnecessary cycles in dealing with the logistics of getting real world tree-like, one-to-many data structures in and out of an antiquated 1980s "relational" database.

Hand Holding

We want to hold your hand and guide you through the process, The documentation for the LAMP stack developer seeking to use the PHP MongoDB driver continues to be meager and anything but appropriate for those who are new to NoSQL. Our Wiki will provide everthing needed to fully implement a LAMP stack enviroment devoid of relational where you as an applciation developer can reap the benefit of the pain and suffering of we had to endure to get to this point. The fact that the older PHP extension Mongo has been deprecated and does not support any version of PHP past version 5.6 has further complicated the adoption of MongoDB by LAMP stack developers, because the new and improved MongoDB driver for PHP has almost nothing in common with its predecessor, causing early adopters like us to learn an entirely new set of PHP classes and refactor all of our legacy code. But, given the headaches we've had to deal with relational databases over the past 20 years of application development, it has been well worth the effort. The new PHP MongoDB Library is now on GitHub and there is a separate set of official documentation on the MongoDB site. There is also a link to the history the legacy drivers/extension and how/why the new drivers/extension evolved to be so different from its predecessor.

public function MongoDate($string=null) {
  $object = null;
  if ($string) {
        $object = new MongoDB\BSON\UTCDateTime(strtotime($string)*1000);
    } else {
        $object = new MongoDB\BSON\UTCDateTime();
  }
    return $object;
}

Ro