Skip to content

Introduction to MongoDB

MongoDB
Tags:

Database’s evolution have change a lot during the last five years, and lately, there is a new concept gaining more and more popularity every day: NoSQL  databases, or in another way, Not Only SQL databases.

The first NoSQL database I have tried is mongoDB, and here I will write a small introduction and the main concepts, although you can find more information on the official website www.mongodb.org.

Basic Concepts

If you are used to work only with relational databases, dealing with MongoDB databases requires an important change on your mind. So, i think knowing the main concepts will make you feel more confortable, and of course, to encourage you to try MongoDB, a document database that provides high performance, high availability, and easy scalability:

A record on SQL is named document on MongoDB, while a SQL table is a collection of documents on MongoDB.

Documents are a set of key-value pairs, like { “key”: “value” } , having a dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection’s documents may hold different types of data.

Opposite to tables on relational databases, keys are alwaysstrings” without special characters like $, #, …. instead of autonumeric (it’s the best option, at least, I belive so when working with relational databases!), and also, keys must be unique, not being allowed to have duplicated keys.

Collections (of documents) organize documents of the same type, allowing the user to “select” them. Normally, collections should have a defined (dinamic) structure.

And …  what are the advantages of this type of databases? high performance. One characteristics of MongoDB is that it’s not a transactional database, so insert-update operations are not on one transaction only, but in several, and some times it’s possible that some operations were executed and some not (on transactional databases  sentences are all executed, or all are not executed).

On MongoDB, documents are stored is BSON format, a modified version of the JSON format, so web development with JavaScript is more easy!

That’s one more reason why mongoDB is so interesting, and it’s becasue you can use it with other cool projects like node.js or Socket.io.

In future post I write more about MongoDB, how to install it, configure it, customize, create new databases, querys, … and more!

Have a nice day!

Manejando Datos Newsletter

Noticias, entradas, eventos, cursos, … News, entrances, events, courses, …


Gracias por unirte a la newsletter. Thanks for joining the newsletter.