DBPedias

All your database knowledge are belong to you

MongoDB

When Should I Use MongoDB

Not all NoSQL databases are the same, that is for sure. Due to the nature of MongoDB being a document-oriented database and its goal of being both fast and highly scalable (a NoSQL value proposition) while providing rich queries and extensible functionality (a RDBMS value proposition) - it truly tries to be the NoSQL database of choice for the traditional DBA. That being said, there are definitely use cases where MongoDB is a good option and use cases where other NoSQL databases (or a traditional RDBMS) may need to be considered.

Well Suited

  • Operational data store of a web site. MongoDB is very good at real-time inserts, updates, and queries. Scalability and replication are provided which are necessary functions for large web sites' real-time data stores. Specific web use case examples:
    • content management
    • comment storage, management, voting
    • real time page view counters
    • user registration, profile, session data
  • Caching. With its potential for high performance, MongoDB works well as a caching tier in an information infrastructure. The persistent backing of Mongo's cache assures that on a system restart the downstream data tier is not overwhelmed with cache population activity.
  • High volume problems. Problems where a traditional DBMS might be too expensive for the data in question. In many cases developers would traditionally write custom code to a filesystem instead using flat files or other methodologies.
  • Storage of program objects and JSON data (and equivalent). Mongo's BSON data format makes it very easy to store and retrieve data in a document-style / "schemaless" format. Addition of new properties to existing objects is easy and does not require blocking "ALTER TABLE" style operations.
  • Document and Content Management Systems - as a document-oriented (JSON) database, MongoDB's flexible schemas are a good fit for this.
  • Electronic record keeping - similar to document management.


Less Well Suited

  • Systems with a heavy emphasis on complex transations such as banking systems and accounting. These systems typically require multi-object transactions, which MongoDB doesn't support. It's worth noting that, unlike many "NoSQL" solutions, MongoDB does support atomic operations on single documents. As documents can be fairly rich entities, for many use cases this is sufficient.
  • Traditional Business Intelligence. Data warehouses are more suited to new, problem-specific BI databases. However note that MongoDB can work very well for several reporting and analytics problems where data is predistilled or aggregated in runtime -- but classic, nightly batch load business intelligence, while possible, is not necessarily a sweet spot.
  • Problems requiring SQL.