Appendix D. MongoDB in PHP, Java, and C++
Each language section describes how to construct documents and make connections, and then ends with a complete program that inserts, updates, queries, and deletes a sample document. All of the programs perform the same operations and produce the same output, so they’re easy to compare. The document in each program is an example of what a simple web crawler might store; for reference, here it is in JSON:
The PHP community has embraced MongoDB with zeal, thanks in no small part to the quality of the driver. The sample code should feel roughly isomorphic to the equivalent Ruby code.