[Discussion]noSQL, Good or Bad?

(oO (||||) (||||) Oo)
Loyal Member
Joined
Aug 6, 2009
Messages
2,132
Reaction score
429
Okay so I think the noSQL idea has been around for ever but now since facebook and other major websites started to use it, I considered looking into noSQL myself.

After few days of reading (10 mins one day, hour another, then maybe 20 mins next day...), I think that noSQL is pretty damn good thing.

Even tho I don't know where to use it yet but I think it's pretty awesome thing. Questions for discussion:
- What do you think of noSQL?
- Have you ever used noSQL? If so, where? If no, then would you consider using it in one of your projects?
- Do you find it a good replacement for MySQL, SQLite, etc?

Info

 
(oO (||||) (||||) Oo)
Loyal Member
Joined
Aug 6, 2009
Messages
2,132
Reaction score
429
Also I still have a question to those that actually use MongoDB in real world applications.

Is it normal to nest objects?

So lets say I have document with blog entries with following structure:
- _id
- title
- text
- date
- comments[]

Then comments have following structure:
- author ObjectID(_id)
- date
- comment

Well nothing big, but what if I have 1000+ comments? Searching would be pain in the butt and I don't know about loading times.

In that case would it be more efficient to store objectIds in comments as an array and then get those comments from different document based on object id? So following structure:

Blog Entries:
- _id
- title
- text
- date
- comments[ObjectID(...), ObjectID(...), ObjectID(...), ObjectID(...) ...]

Comments:
- _id
- author ObjectID(_id)
- date
- comment

Users:
- _id
- username
- password
- email

---------- Post added at 01:13 PM ---------- Previous post was at 12:22 PM ----------

Also another question. Let's say I have setup replica set so I have 4 nodes.
127.0.0.1:27017
127.0.0.1:27018
127.0.0.1:27019
127.0.0.1:27020

And 27017 is selected as primary node. Then it fails and other nodes elect 27020 as primary node.

If my application was connecting to server on port 27017 as a primary node, and obviously it lost connection due to node failure, what should I do in my application? Try reconnecting on different port? Connect to any other node and get address of primary node and reconnect to new primary node?

Answer: drivers have support for replica

 
Last edited: