image

In today’s post we wanted to give you a short introduction to the most popular “schemaless” database, MongoDB, and explain how we use it here in Testomato.

In recent years, “schemaless” database systems have gained a small, but strong following, especially in open-source development. NoSQL databases approach data storage in a considerably different way than the traditional SQL model and are particularly well-liked for their flexibility and easy integration.

First things first…what is it?

MongoDB is an open source, document-oriented database that is scalable, schemaless, and queryable. While there are a few other NoSQL databases out there, MongoDB is currently the most popular. It has native drives for pretty much every major language and dynamic querying capabilities – making it a strong match for dealing with constantly evolving data structures in web applications.

There are a few differences, but the most considerable difference from MySQL is that Mongo focuses on BSON (binary JSON) instead of SQL queries. This means that you can access most of MongoDB’s functionality directly through JavaScript notation.

Here’s how and why we use MongoDB at Testomato:

Scalability

Testomato is still in its early stages, but we already store data for about 2,000 projects every month, and we anticipate more growth in the coming year. We have 6 web servers, and the following 4 Mongo database servers: a Master, slaves, and 1 hidden slave that is used for backup. We also have a MySQL server for our user data account (registration information).

image

Currently, we don’t need Mongo’s automatic sharding features, which allows horizontal scaling of data by partitioning data across multiple servers, but they are useful to know about.

Document-oriented vs. relational

It’s not necessary to translate data structures back and forth to the tables of a database in Mongo because it stores documents in collections. The data in Mongo is not enforced by a schema: documents do not need to share the same fields or structure, and the fields in a collection’s documents may contain different types of data.

Testomato runs about 300,000 tests a day and stores the results.  Mongo allows us to store our data in almost exactly the same form it is represented in Testomato, making it useful for modeling our user projects, test settings, test results, and history.

Our own business objects layer

We use a PHP extension for MongoDB to help us create and manage connections and store data.  Additionally, our developers have created their own layer above this Mongo client to store our business objects directly into our Mongo database.

image

Schemaless means a flexible future

In the beginning, we needed a quick solution, and the best part of using a schemaless database was the speed in which we were able to start storing everything.

But at this point, it’s time for us to consider the future of Testomato and MongoDB allows us to be ready for any changes we make. In regards to our goals, this the strongest advantage of using MongoDB: a schemaless model is designed to help us easily adapt to the changing requirements that are inevitable in any tech startup.

Did you find this post helpful? What do you think about “schemaless” databases? 

Leave us a comment here or on Facebook. Or, tweet us directly @testomatocom.