NoSQL: I still don't get it...

KMatle

Expert
Licensed User
Longtime User
I'm working with relational db's for over 20 years now. I know exactly how to design even huge db's with billions of rows, relations, etc.

Now everyone's talking about NoSQL. Almost all "examples" tell some basics and then switch directly to "it's sooo wow and faster and - hey - see who's using it <list_of_companies as array>".

To me it's a big JSON string with lists, maps, etc. The main question remains: How do I design it? Just adding maps is not enough I think :)

Does anyone know a REAL example (no theory)?
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
I will make it stupidly simple. NoSQL is nothing more than creating physically the rows and cells of a database. Something I learned in school about 25 years ago...

Admit you have two clients. Create a directory named clients than inside of it two sub directories (one for each one).
Inside those directories you could have dedicated files for their addresses, bills, users, etc.

When you create a new client you insert the reference to its subdirectory inside a map with for key the reference of the client and for value the path to his subdirectory. That map is stored in the root (or in a dedicated other folder).

Now, what is important is to know that you can use some scripts to aggregate the data before a request is done. For example when you create a new bill for a client, you won't have to analyze the data immediately. If your data is fully organized (using a map, a json, XML...) a script started by a cron can reference all the information as you like, how you like...

That's not new, that's not magic, perhaps quicker for massive data usages but that's not revolutionary for small projects. The idea behind that is the ability to move or prepare data to every known needs before any request. But that's all. In fact if you think about you use the same (or perhaps more) efforts / resources to maintain data compared to using a database.

I hope to have cleared things even if I was so simple
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is a B4J library for MongoDB: https://www.b4x.com/android/forum/threads/72160/#content

It is definitely worth downloading MongoDB and playing with it. I don't think that it will allow you to solve any problem that you cannot solve with a relational database.
However I can see many cases where it is easier (and more fun) to use a document based database over a relational database.

I think that as developers we should always strive to learn new technologies. It is less important whether you actually use them in the end. For me it is enough to understand how the technology addresses challenges that I'm familiar with, in a different approach.
 

KMatle

Expert
Licensed User
Longtime User
I've seen a video series from Google explaining it very good:
On part 3 or 4 I must laugh. It was about comparing queries between NoSQL and SQL. With one attribute like "age > 50" it was similar. Then I was curious how they do a and query (location = Berlin and age > 50). To do this you must add another node (mixed) called "location_age" to all children. This was the point where I switched off.
 
Top