0
votes

There are alot of resources with modeling document NoSQL databases that describe embedded vs normalized, multicollection approach. But i could find very few about third, middle-way, which actually sounds most like the core of NoSQL: keeping multiple document types in same collection.

There are implementation details like having type field for each document and index on it but what i cannot find some info about is what is the turning point in deciding if some documents should be separate into different colletions or kept within the same?

I've found some sources mentioning collection size, but still, that doesn't either sound like the good reason because sharding/scaling single collection with multiple document types also sound like a perfectly viable option to me.

So, i am trying to find out some explanation, what is that 'The Reason' when deciding between single collection multiple document types vs multiple collections each storing one document type?

I don't know if its significant, but if it is, i am thinking in context of MongoDB and DocumentDB.

1

1 Answers

3
votes

A collection in Cosmos DB is a billable entity, where the cost is determined by the throughput and used storage. Collections can span one or more partitions or servers and can scale to handle practically unlimited volumes of storage or throughput.

Microsoft Azure Cosmos DB strongly suggests to store documents of different types into the same "collection".

But having multiple collections is something that can be quite useful for different use cases:
1. Multi-tenancy: you want to be sure all data are separated
2. Different types of data requiring different partitioning strategies