I am using Azure CosmosDb as the database of my application.
Let's say that I need to save all the countries and cities and streets in my database. So, I would have an item who looked like this:
{
country: Brazil,
size: 1000,
population: 200000,
cities: [
{
city: Rio
population: 8000
streets: [
{
name: A,
postalCode: 12345
},
{
name: B,
postalCode: 34567
}
],
...
However, as I am talking about all the countries and cities and streets, this becomes a huge item, bigger than the 2Mb allowed by the cosmosDb.
So, what is the correct way to deal with this? Should I separate the cities and streets in different collections? However, using different collections have many drawbacks, since it is not possible to use stored procedure or guarantee the transaction when updating two different collections.