Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is MongoDB a good choice for storing JSON structures?

MongoDB seems appealing because in JavaScript front-end applications, especially those that leverage Backbone and its collections, all the data and application state is organized in deeply nested JSON structures.

Building a relational DB schema in MySQL can be a pain, because you are essentially breaking down a JSON object into granular tables, determining the foreign keys and restraints. Its a real excessive exercise for someone who doesn't maintain databases for a living.

Will MongoDB address these issues? I assume i could simply save a Backbone Collection if it is structured correctly and be able to join the data later across other related documents? Or is MongoDB overkill and more of a performance machine instead of a document storage solution?

like image 959
Abadaba Avatar asked Feb 21 '12 07:02

Abadaba


1 Answers

MongoDB seems appealing because in JavaScript front-end applications, especially those that leverage Backbone and its collections, all the data and application state is organized in deeply nested JSON structures.

Yea, in mongodb you can store any json structure. Nesting is a one of benefits of mongodb. You can store data in natural way without thinking about relations. You can store data directly as your client JavaScript require.

Building a relational DB schema in MySQL can be a pain

It for sure highly depends on structure you want store, but if you talking about deeply nested json structures mongodb will work best for you.

Or is MongoDB overkill and more of a performance machine instead of a document storage solution?

No, mongodb not just performance machine, it is perfect storage for unstructured, deeply nested documents. And in same time mongo have very good performance, especially when working with highly deep documents (because no need join them).

like image 84
Andrew Orsich Avatar answered Oct 05 '22 08:10

Andrew Orsich