Hi all,

I've been looking into NoSQL (particularily MangoDB) and am liking what I see. I have one clarification though:

If I'm gathering data about a particular "thing" on a daily basis, should I have one document per "thing" and add the new data to it every day? Or should I be creating a new document for each day's data?

I would prefer to expand the document with each days findings, but fear that this could have performance issues as the document could expand indefinitely. Or is this the point of NoSQL and am I stuck in a relational mindset??

Thanks!

Recommended Answers

All 3 Replies

Member Avatar for LastMitch

I would prefer to expand the document with each days findings, but fear that this could have performance issues as the document could expand indefinitely. Or is this the point of NoSQL and am I stuck in a relational mindset??

It would be easier if you have a query with what you mention so it would be much easier to see why you want to used MangoDB.

To me it's just all query but you can put any query any language as long the query is correct and working and it will function in any language as long as the query is working.

So having a document of infinite key/values will not harm performance?

Sorry, I don't have any queries in mind, I'm just getting it all in my head of how to set out a database. But maybe say I want to hold a set of values, collected each day, to plot a graph, I may have a document containing:

{ name: "daily_avgs", day1: 2, day2: 7, day3: 4, ... }

In a relational datbase I would have a table as follows (as an example):

name       | day  | value
---------------------------
daily_avgs | day1 | 2
daily_avgs | day2 | 7
daily_avgs | day4 | 4
...

However the MangoDB is more flexible and will eventually be better for statistical analysis. Is that how to use MangoDB/NoSQL or should I be using a different document per value, same as a relational setup:

{ name: "daily_avgs", day: "day1", 2 }
{ name: "daily_avgs", day: "day2", 7 }
{ name: "daily_avgs", day: "day3", 4 }

Or am I overthinking all this?

I guess my main question could be summed up into: Is having a document of infinite elements going to eventually cause performance issues? Or is that what NoSQL was designed for?

Hope that all makes sense!

Member Avatar for LastMitch

So having a document of infinite key/values will not harm performance?

Read this:

http://nosql.mypopescu.com/post/659390374/comparing-document-databases-to-key-value-stores

Apparently you are asking about whether how to used NOSQL (MangoDB).

You know there's alot of database out there.

It's bit hard to get familiar with all of them.

But the only thing is the same is a query.

So your table has 2 column: name & day?

Is that how to use MangoDB/NoSQL or should I be using a different document per value, same as a relational setup:

Read this about the features on NoSQL have:

http://blog.monitis.com/index.php/2011/05/22/picking-the-right-nosql-database-tool/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.