Greg
Greg

Reputation: 6613

nosql and data organization

So I'm writing an application that would allow a user to create a type of quiz. Each quiz can be different, IE they will have unique questions and answers. I've never played with any nosql database and I'm trying to wrap my head around how a nosql database (couch, mongo, etc...) actually organize the data. It seems this kind of data storage might lend itself well to this type of application (IE no tables that define how many questions can be asked) but I'm still unsure of how a nosql database actually works.

I tend to be more of a visual learner, can anyone point me to some good visuals or describe how nosql databases actually organize the data they hold?

Upvotes: 3

Views: 1925

Answers (1)

Andrew Orsich
Andrew Orsich

Reputation: 53675

I will talk about monogdb. Mongodb store her data in bson format (binary json). You can keep think that it store data in json format.

Mongodb contains one big benefit that you can use -- ability to embedd documents. You can use this feature in your application:

So you can embedd answers in your questions collection like this:

questions {
   _id: 1,
    text: "What is your name",
   answers: [
    {
      order: 1,
      text: "Andrew"
    },
   {
      order: 1,
      text: "Greg"
    }
   ]
}

Embedding usual keeps your database schema simpler and allow to avoid joins and data in general looks more naturally. For example in sql worlds you does not have any other solution as create separate tables for questions and answers.

Another benefit you may use is - scalability. Mongodb was designed to be fully scalable, it support sharding and replica sets.

You can start reading about schema desing more here. Also you can look into little monogdb book, there only 30 pages, but it should help understand more deeply how mongodb works.

Just choose some nosql database and try to play with, you have fairly simple project to start with. And i am sure that you will love it once try.

Upvotes: 4

Related Questions