I have just started with NodeJs. Most of the places I saw NodeJs + MongoDB. Even books are published with that title. It looks similar to PHP + MySQL :).
What is the reason behind it?
First of all, MongoDB is a NoSQL database. It doesn't use any form of fancy query language to store, retrieve or manipulate data. MongoDb organizes data with BSON (binary JSON) which creates a kind of natural flow with Node (I think). Node developers can relate more to BSON than with SQL. But you should also know that you can use any database engine of your choice, but MongoDB feels more natural when working with Node.
I think it aligns with how you work with data in JavaScript. In JS, we use JSON format all the time to work with data in js. Similarly NodeJS developers find it easy to work with documents where you can add/change data without having to worry about a particular fixed schema. So Its not the appeal coming from mongo but the idea of NoSQL databases. It just happens that mongo is a easy to get started with and popular NoSQL database.
Mongo is a good product. Also, like what most of the others have said, they came out around a similar time period. Plus being able to leverage JSON/BSON is like gold for JS devs.
Lately though, I've been using RethinkDb as my document data store. If you're a JS developer you'll really appreciate the syntax
I think the main reason is they were born in the same period - the time when people start worrying about the new requirements and patterns in system architecture such as replication, scalability, big data, RESTful, JSON, devops, etc.
Justin Njoh
MVPs & POCs on NoSQL DBs - why not ?
Sandeep Panda
co-founder, Hashnode
MongoDB uses BSON (Binary encoding of JSON) format for storing documents in collections. And as you know Node.js is JavaScript runtime. As @kayandrae said, Node developers usually relate more to BSON format rather than traditional relational DB. Storing JavaScript objects in terms of documents (in collections) just makes sense to them. MongoDB is schema-less and therefore far more relaxed than SQL DBs. So, if a Node.js developer needs to store one more property in a document they will just add one (just like you add a property to a JS object) and save the document.
Finally, JSON format is native to JavaScript and since MongoDB lets you store JSON documents Node + MongoDB makes sense.