'How to insert a message of 20 mb into Azure Cosmos DB - Document DB API
We have a requirement for our application to handle incoming message requests of up to 20 MB in a transaction. This message is well structured and has nested objects and arrays. We are planning to use Azure Cosmos DB (Document DB API) as our database. As Document DB has a limitation of 2 MB as the maximum document size, we have modeled our message data to be stored in several document. We were trying to insert all these documents in a transaction using the Javascript Store Procedure, but the SPs have a size limit (2 MB) on the request size.
Can anyone help us with how we can save all the documents related to the 20 MB message in a transaction (save all or none)?
One way I have come across is to save the documents independently, and write a store procedure to identify and delete them all in case one of the write fails. I'd like to know if this is the best available approach for our scenario.
Edit: Another possible approach I was thinking about - Upload the 20 MB message into a blob storage, and access it from inside the SP to split and insert. But I couldn't find a way to access the blob from the javascript SP (XMLHttpRequest was not allowed in the SP)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
