0
votes

Just starting with CosmosDB. I am trying to write a stored procedure for my CosmosDB data in the Azure portal (Data Explorer). I am able to create a new stored procedure and execute it, but I am unable to save any changes to the procedure. When I try, I get the following error message:

Error while updating stored procedure testSP:
...
Create, update, or delete scripts in direct mode in collections with multiple partitions is not allowed.

Not sure what direct mode means. How do I get around this?

1
This is a temporary error that is happening on Collections that were previously Not Partitioned, fix for this is being released shortly. Meanwhile, the suggested workaround using the SDK will work.Matias Quaranta

1 Answers

1
votes

Can you try with ReplaceStoredProcedureAsync ?

try 
{
    await _client.CreateStoredProcedureAsync(...);
} 
catch(DocumentClientException dex) when (dex.StatusCode == HttpStatusCode.Conflict) 
{ 
    await _client.ReplaceStoredProcedureAsync(...);  
} 

Related thread