I am working with Azure Cosmos DB, I am programming the client side in C# (web service) and I'm writing some server side Stored Procedures with java-script.
How can I debug my stored procedure's code?
Thanks,
MAK
Azure Cosmos DB stored procedure is JS script running on the server, you can not debug it on your side. However , you can use console. log () to log some key steps in your stored procedure as below. Then use getScriptLog to get the output from stored procedure console.
Azure Cosmos DB provides language-integrated, transactional execution of JavaScript. When using the SQL API in Azure Cosmos DB, you can write stored procedures, triggers, and user-defined functions (UDFs) in the JavaScript language. You can write your logic in JavaScript that executed inside the database engine.
Azure Cosmos DB stored procedure is JS script running on the server, you can not debug it on your side.
However , you can use console.log ()
to log some key steps in your stored procedure as below.
Then use getScriptLog to get the output from stored procedure console.log()
statements.
Please note that EnableScriptLogging = true
is necessary to print console.log:
var response = await client.ExecuteStoredProcedureAsync(
document.SelfLink,
new RequestOptions { EnableScriptLogging = true } );
Console.WriteLine(response.ScriptLog);
You could refer to this official doc.
Hope it helps you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With