I've checked a few other threads around the topic and search around, I am wondering if someone can give me a clear direction as to why should I consider NoSQL and which one (since there are quite a few of them each with different purposes)
- Why NoSQL over SQL?
- Is MongoDB the right choice in my case?
- https://softwareengineering.stackexchange.com/questions/5354/are-nosql-databases-going-to-take-the-place-of-relational-databases-is-sql-goin
Like many others - I started with relational databases and been working on them ever since, thus when presented with a problem, the first instinct is to always think of "I can create these tables, with these columns, with this foreign keys", etc
My overall goal is How to get into "NoSQL" mindset? ie getting away from the inclination of always thinking about tables/columns/FKs (I understand that there are cases where RDBMS is still the better way to go)
I am thinking of 2 scenarios for example just to get more concrete direction
Scenario 1
Imagine a database to model building a furniture instructions (think of IKEA instructions) where you would have the object "furniture" which would have a list of "materials" and have a list of "instructions"
- Furniture - would simply have a name that have a list of Materials and Instructions
- Materials - would be a name + quantity, may be we can even have "Material Category" table as well
- Instructions - would simply be an ordered list of texts
My first instinct would go the RDBMS way:
- Create a table called "Furniture", "Material" and "Instruction" and the approppriate columns
- Create the appropriate JOIN tables as necessary and FKs
The use of this system can include searching based on materials or may be combination of materials. And may be think of extending the data stored to include information on how many people are required to build it? Difficulty level? how much time it would take?
Would something like this be a good candidate for a NoSQL database?
Scenario 2
Imagine a database to model a User database with basic information (eg. name, email, phone number, etc), but you also want to have the flexibility of being able to add any custom fields as you wish.
Think of different systems consuming this user database, each system will want to have their own custom attribute to be attached to the user
My inclination would go the RDBMS way:
- Create a table for "USER" with columns: ID, name, email, phone
- Create a table for "USER_ATTRIBUTE" with columns: ID, USER_ID, attr_name, attr_type, attr_value
The USER_ATTRIBUTE will allow that customization and flexibility without having to shut down the system, alter the database and restart it.
Would something like this be a good candidate for a NoSQL database?