Zhe
Zhe

Reputation: 1070

Is mongodb a good way to save important data?

I'm trying to using mongodb as my primary database. I want to save all data in mongodb like account data ( email, password, id .... ).

But mongo is a new db and no sql is new compare with sql ( mysql, postgresql ).

So I'm not sure it is a good idea to use it save all data.

Please tell me if you have some idea or opinion. If you don't like mongo, please add your suggestion.

PS: My project is a simple light blog service with nice UI design. And user can link their service or feed like twitter timeline into their blog.

Upvotes: 2

Views: 1149

Answers (2)

Faheem Sohail
Faheem Sohail

Reputation: 846

As far as stability is concerned, although mongodb is new, there are many production users using mongo successfully, a complete list of which is available at on the mongodb website. If done correctly, a mongodb implementation should be as stable as mysql.
The bigger question however is when to use mongodb and for which type of usecases. Gone are the days when you throw a Relational database for every type of persistence. Have a look at this blog post from Martin Fowler where he describes what is being termed as polygot persistence or using multiple persistence platforms to serve specific needs within a single application. Mongodb is a document oriented database where the unit of storage is a json document. Joins are not supported therefore if your entities are more-or-less self-contained and do not need cross-referencing or looking up other entities, you may say mongodb is a fit. I would not try and model a social network in mongodb. Some typical cases where mongo is a fit are for example, a product catalog for an e-commerce website where each product is a document, or a system for storing and retrieving runtime logs.
So,to answer your question, yes you can use mongodb to store all your data, and yes it will be stable enough for your needs if setup correctly but it might not be the most optimal choice for every type of usecase.

Upvotes: 0

Remon van Vliet
Remon van Vliet

Reputation: 18625

MongoDB and other NoSQL databases are not a drop-in replacement for MySQL or any other RDBMS. They are different tools with different pros/cons. That said MongoDB is a good fit for a blog service and there are no significant durability concerns if you use it correctly. MongoDB supports things like fire-and-forget writes which obviously are not as safe as, say, a MySQL INSERT. However, MongoDB has safer write modes all the way up to making sure the write is replicated to the majority of nodes.

In short, there's no valid argument against MongoDB when you look purely at "will it save my data correctly" but it is a different tool than MySQL and as such it comes with it's own set of rules. Make sure you know them.

Upvotes: 5

Related Questions