FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


MongoDB - How to create structure?





zacky
So we know mongoDB is non RDBMS query language and in fact it doesn't promote you to construct your collections ( tables ) in that way, although there are some still support to pairing id from one collection to another.

However I get confused on this mainly because I am not sure how will going to construct my database and tables. For example I tend to separate the collections from one another as I learn from MySQL as to separation of concerns and use. Now I am not sure what I need to unlearn so I can fully grasp the concept of noSQL database like mongoDB.

Any help?
jottbe
zacky wrote:
However I get confused on this mainly because I am not sure how will going to construct my database and tables. For example I tend to separate the collections from one another as I learn from MySQL as to separation of concerns and use. Now I am not sure what I need to unlearn so I can fully grasp the concept of noSQL database like mongoDB.

Any help?


Hi Zacky,

I see this post is already some years old, so I hope you already found your answer, but for others who find this post some of my thoughts on your questions:

1. In mongoDB there is no such thing as a schema. MongoDB is schemaless. That means, there is also no such thing like a table. The thing that comes the closest to tables in a relational database is collections. But you could (if you want) put things in your collection, which are completely different like customers, goods, orders all in one collection (but I think nobody would like to do that).
So how can MongoDB do something like that? the point is, that the description of the data (which would be the schema in a relational database) is stored along with the documents which are stored as BSON and displayed as JSON, so the contain the data and the attributes in which the data is stored.

2. You seem to try to put all noSQL databases in one bin. You shouldn't do that. I think the different types of noSQL databases are so different from each other as are noSQL databases in comparison to relational databases.

3. MongoDB imho has some big advantages over relational databases but on the other hand doesn't cover all what relational databases cover as well at the same time. Some of the big advantages are:
- if you are not familiar with databases, you are faster to get productive with mongo db
- it's great for rapid prototyping and fast development cylces (because you have no or fewer problems with compatibility between data structures and programs that use them)
- it supports very huge data bases while allowing to have good response times even on standard hardware (through sharding and replica sets). MongoDB is extremly scalable. Much more than any relational database could ever be (but at the costs of joins and transactions).
- it is very suitable for projects in which it is hard or impossible to know the data structure you end up from the beginning (so projects in which you have to cope with a rapidly evolving data structure) like if you analyze data or maybe in web scraping or similar projects
On the other hand:
- I think to get the full benefits, you need to know the access pattern to the data very early. If you have several data "pots" where you constantly have to "join" data of different objects which can't be denormalized (or prejoined if you like to call it like that), you might get a harder time with mongodb than you would have with relational databases, because you have to build that logic on your own in your application. But if you can prejoin, this probably can also make your program faster, because it can fetch the relevant data in less separate queries than on relational databases.
- You have no transactions in MongoDB. This sounds very hard, but on the other hand, you usually organize your data differently in MongoDB than you do in relational databases. You can "prejoin" data so that for example in your order document you already have all the order positions included whie in a relational database they are usually separated in two or more tables. If you have an order in one document and make alterations on that document MongoDB ensures that all changes in that document are done atomically (all changes, or none of the changes on the document). So you have something like transactions on document level.

Anyone who want to learn about mongoDB I'd suggest to take a free course at the mongoDB site. It usually takes 7 weeks and is rally great.
Related topics
Abortion: Yes or No?
How to create template with DreamWeaver?
Tutorial: How to create flash drop down menus and site navig
Can I create a brand new account in my account?
script backup database
Basic Search Engine Optimizing
create a new forum at Humor
got this error..
Create something like FSter
Create flash text or flash logo with tools
Create logo online - cool
SLOW UPLOADING AN SQL FILE
C++ TUTORIAL : INTRODUCTION TO C++
Can't create socket while using ftp access
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.