MongoDB 1.0: the document database that opens the practical NoSQL era

MongoDB 1.0 (August 2009) by 10gen: JSON-native document database, BSON as binary format, JavaScript shell, AGPL 3.0 licence. The concrete entry of the NoSQL paradigm into mainstream web development.

Open SourceWebR&D MongoDBNoSQL10genDatabaseDocument StoreCloudOpen SourceFull-Stack

Beyond relational

The first decade of the 2000s saw consolidation of Open Source relational databases — MySQL and PostgreSQL as dominant choices — alongside growing unease with the relational model for emerging scenarios: web applications with rapidly evolving schemas, social networks with graph structures, analytics on heterogeneous datasets, IoT with semi-structured streams.

The term NoSQL — re-emerged in 2009 at a San Francisco meetup — identifies a family of alternative approaches: key-value stores (Riak, Voldemort, Dynamo), column families (Cassandra, HBase), graph databases (Neo4j), document stores. Among document stores, MongoDB is the first to reach widely used production.

MongoDB 1.0 was released on 11 August 2009 by 10gen (Eliot Horowitz, Dwight Merriman, Kevin Ryan), a company founded in 2007 initially to build a PaaS platform, later pivoted to just the database.

The data model

MongoDB stores documents — the fundamental unit, analogous to JSON objects — grouped in collections within databases. No predefined schema: documents in the same collection can have different fields.

The serialisation format is BSON (Binary JSON), a binary extension of JSON with additional data types (ObjectId, Date, Binary, Regex, Int32/64, Decimal128).

A typical document:

{
    "_id": ObjectId("4f7d3e8b..."),
    "name": "Mario Rossi",
    "age": 52,
    "addresses": [
        { "type": "home", "city": "Pisa" },
        { "type": "work", "city": "Florence" }
    ],
    "tags": ["premium-customer", "subscriber"]
}

CRUD operations:

  • db.customers.insert(doc) — insert
  • db.customers.find({tags: "premium-customer"}) — query with MongoDB-specific filters
  • db.customers.update({_id: ...}, {$set: {...}}) — update with atomic operators
  • db.customers.remove({...}) — delete

The JavaScript shell

MongoDB exposes an interactive JavaScript V8-based shell (Mongo Shell). Queries are literally JavaScript; complex operations (aggregations, map-reduce) are written as JS functions executed server-side. This choice is natural for web developers already familiar with JS and will make MongoDB particularly popular in the Node.js ecosystem (emerging in parallel, 2009).

Indexes, query optimiser, concurrency

MongoDB 1.0 supports:

  • Indexes — B-tree on single or compound fields, with unique constraints
  • Query optimiser — picks the best index, with manual hint possible
  • Database-granularity locks (global in 1.0)
  • Transactions limited to single document

The lack of multi-document ACID transactions is an explicit trade-off: MongoDB prioritises horizontal scale and speed over complex transaction atomicity. A friction point with traditional finance/accounting applications; acceptable — or manageable — in web, analytics, logging applications.

Replication and sharding

MongoDB 1.0 already supports:

  • Master/Slave replication with manually managed failover
  • Horizontal sharding (in preparation for subsequent releases)
  • Server-side map-reduce for aggregations

Declared ambition: scale to many nodes without rewriting the application. The promise will prove partially true: MongoDB sharding is sophisticated but requires careful shard key design.

AGPL 3.0 licence and controversies

The choice to distribute the MongoDB server under GNU AGPL 3.0 — Affero GPL — has been controversial. AGPL extends GPL’s copyleft to the “use over a network” case: a SaaS service exposing modified MongoDB should make the code available. In 2009 AGPL is less accepted than Apache 2.0 or MIT in enterprise environments, many CIOs have reservations.

10gen responds with:

  • Client drivers distributed under Apache 2.0 — applications using MongoDB are not “contaminated”
  • MongoDB Enterprise — commercial subscription with QA, support, auditing

Drivers and integration

At 1.0 release MongoDB has drivers for:

  • Python — PyMongo, mature
  • Ruby — for Ruby on Rails
  • PHP — official driver
  • Java — for enterprise applications
  • C#/.NET — community driver

The Node.js driver is spreading rapidly alongside the birth of Node.js itself (2009), foreshadowing full-JavaScript web stacks.

Adoption

As of 2009-2010 MongoDB is adopted by:

  • Craigslist — classified archive
  • Foursquare — social check-in
  • bit.ly — URL shortener
  • The New York Times — form data management
  • SourceForge — migration from MySQL

Typical applications: content management, product catalogues, user sessions, logging, user-generated content, IoT data.

In the Italian context

As of 2009 Italian MongoDB adoption is limited to:

  • Startups and web agencies exploring non-relational stacks
  • Universities — NoSQL research projects
  • Some publishing sites — content management

Historical role

MongoDB 1.0 democratises the NoSQL approach: with a mongodb:// connection string and a driver installed in minutes, a developer can build an application with document storage without SQL schema ceremony. It is not technically the first document store (Lotus Notes, CouchDB precede it), but is the one aiming to reach critical adoption mass, de facto defining the “modern” NoSQL pattern.


References: MongoDB 1.0 (11 August 2009), 10gen Inc. (later MongoDB Inc.). Eliot Horowitz, Dwight Merriman, Kevin Ryan. AGPL 3.0 (server), Apache 2.0 (driver) licences. BSON format. JavaScript V8-based shell.

Need support? Under attack? Service Status
Need support? Under attack? Service Status