Databases26k+ stars

MongoDB

The most popular document database

Commit Details

Message
"Initial commit"
Author
Dwight Merriman
Date
2009-02-01
Hash
8b8b8b8b8b8b8b8b8b8b8b8b8b8b8b8b8b8b8b8b

Fun Fact

The name MongoDB comes from "humongous". It was created at 10gen (now MongoDB Inc.) as part of a PaaS product before being spun out.

</>First Code

C++
// MongoDB - The database for modern applications
// (C) 2009 10gen Inc.

#include "pch.h"
#include "db.h"

namespace mongo {

    void Database::createCollection(const string& name) {
        // Create a new collection (similar to a table)
        NamespaceDetails* d = new NamespaceDetails();
        collections[name] = d;
    }
    
    BSONObj Database::findOne(const string& ns, const BSONObj& query) {
        // The magic: flexible schema, document-oriented
        return Cursor(this, ns).findOne(query);
    }

} // namespace mongo