简体   繁体   English

如何调试Azure Cosmos DB存储过程?

[英]How to debug Azure Cosmos DB Stored Procedures?

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. 我正在使用Azure Cosmos DB,我正在使用C#(Web服务)编写客户端,我正在使用java脚本编写一些服务器端存储过程。

How can I debug my stored procedure's code? 如何调试存储过程的代码?

Thanks, 谢谢,

MAK MAK

Azure Cosmos DB stored procedure is JS script running on the server, you can not debug it on your side. Azure Cosmos DB存储过程是在服务器上运行的JS脚本,您无法在其上调试它。

However , you can use console.log () to log some key steps in your stored procedure as below. 但是,您可以使用console.log ()记录存储过程中的一些关键步骤,如下所示。

在此输入图像描述

Then use getScriptLog to get the output from stored procedure console.log() statements. 然后使用getScriptLog从存储过程console.log()语句中获取输出。

Please note that EnableScriptLogging = true is necessary to print console.log: 请注意,打印console.log需要EnableScriptLogging = true

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. 希望它能帮到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM