Reputation: 83
How does DocumentDb handle the case, when a document update results in exceeding the collection size (10 GB). Say I have 50K documents in one of my collection and then I update all of the documents to include an additional JSON section that could exceed the collection size.
What are the best practices to handle this case and is there built in support to handle this scenario (e.g. Move that document to another collection).
Upvotes: 0
Views: 118
Reputation: 71055
There's no specific best practice, but you have specific things built into DocumentDB to help you make proper decisions:
x-ms-resource-usage
is a header returned on your queries. Among other things, collectionSize
will report total consumption within your collection, including overhead from indexes, etc. You can compare that to collectionSize
in the x-ms-resource-quota
header returned (which should equate to 10GB), to know how much overhead you have remaining. There's a bit more detail in this answer.Regarding your question about moving documents to different collections: That's ultimately going to be your call whether to do this within your code or by taking advantage of partition resolvers.
Upvotes: 1