Trying to migrate from RDBMS to NOSQL ( to be specific MongoDB). So couple of things that i've got so far:
1) Denormalization is ok for nosql
2) Data duplication is ok.
So i'm puzzled with duplicated data update...
Let's imagine we have cars and boats. They have common color property. Then we decided to rename color. We don't want to use "Red", we want to use "Bright red" instead.
RDBMS case: So for example in RDBMS i will have three tables : car, boat, color. Car and Boat have foreign keys linked to Color table. I'll update only one table with one query and get consistent data.
NOSQL case: I have two collections... Boats and Cars. We have color field for each document. E.g. Boat { color:"red", type:"fast" }
Car{ color:"red", type:"slow" }
So when i want to change color name, i should run two queries (for each collection) and update each document where color == "red"? But what if i have dozens of collections with duplicates and could FORGET one of them? Is there any common approach/DB design to avoid/ease cope with such cases? Or this is one of nosql trade offs?
1) Denormalization is ok for nosql
While indeed it is ok for nosql it may be not ok for your particular project. When you decide what to use sql or nosql you should weight the pros and cons.
2) Data duplication is ok.
this is mostly consequence of denormalization, so all the same applicable here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With