Reputation: 4775
For example lets assume below nested data : where each word marked with '^' will have PLENTY of CRUD operations. And words which are NOT marked by '^' will also have CRUD operation but in limited numbers.
Additionally, there can be new children to these 'words' going ahead.
What will be good design options/questions that has to be considered to represent this data. A single document or multiple documents in mongodb(NoSQL) ?
DISTRICT^
cities^
streets
flats^
houses
rooms
lightBulbs^
Upvotes: 2
Views: 154
Reputation: 9473
First of all you need to think about 16MB document size limit - if this will be a case - then data need to be in more than one document.
Then - you need to be able to build effective queries on that structure. So try to build you schema bottom up (means include members from bottom to up), and load with test data - to see performance. Mongo give nice flexibility in updating sub-documents, but on driver level (like c#) you can end-up with getting full big document, perform in-place update and push changes back to mongo.
When you split data - then you will have to perform a set of updates on affected data - so you will loose one atomic update on one document.
Other thing to consider is an architecture (one server or sharding clusters), that will have impact on how you can split load and scale.
Upvotes: 1