Databases are the workhorses of the information age. Like Atlas, they go largely unnoticed in supporting the digital world we’ve come to inhabit. It’s easy to forget that our digital interactions, from commenting and tweeting to searching and sorting, are in essence interactions with a database. Because of this fundamental yet hidden function, I always experience a certain sense of awe when thinking about databases, not unlike the awe one might feel when walking across a suspension bridge normally reserved for automobiles.
The database has taken many forms. The indexes of books and the card catalogs that once stood in libraries are both databases of a sort, as are the ad hoc structured text files of the Perl programmers of yore. Perhaps most recognizable now as databases proper are the sophisticated, fortune-making relational databases that underlie much of the world’s software. These relational databases, with their idealized third-normal forms and expressive SQL interfaces, still command the respect of the old guard, and appropriately so.
But as a working web application developer a few years back, I was eager to sample the emerging alternatives to the reigning relational database. When I discovered MongoDB, the resonance was immediate. I liked the idea of using a JSON-like structure to represent data. JSON is simple, intuitive, human-friendly. That MongoDB also based its query language on JSON lent a high degree of comfort and harmony to the usage of this new database. The interface came first. Compelling features like easy replication and sharding made the package all the more intriguing. And by the time I’d built a few applications on MongoDB and beheld the ease of development it imparted, I’d become a convert.
Through an unlikely turn of events, I started working for 10gen, the company spearheading the development of this open source database. For two years, I’ve had the chance to improve various client drivers and work with numerous customers on their MongoDB deployments. The experience gained through this process has, I hope, been distilled faithfully into the book you’re reading now.
As a piece of software and a work in progress, MongoDB is still far from perfection. But it’s also successfully supporting thousands of applications atop database clusters small and large, and it’s maturing daily. It’s been known to bring out wonder, even happiness, in many a developer. My hope is that it can do the same for you.