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

MAK*_*MAK 12 javascript c# stored-procedures azure azure-cosmosdb

我正在使用Azure Cosmos DB,我正在使用C#(Web服务)编写客户端,我正在使用java脚本编写一些服务器端存储过程.

如何调试存储过程的代码?

谢谢,

MAK

Jay*_*ong 16

Azure Cosmos DB存储过程是在服务器上运行的JS脚本,您无法在其上调试它.

但是,您可以使用如下console.log ()记录存储过程中的一些关键步骤.

在此输入图像描述

然后使用getScriptLog从存储过程console.log()语句中获取输出.

请注意,EnableScriptLogging = true 打印console.log是必要的:

var response = await client.ExecuteStoredProcedureAsync(
    document.SelfLink,
    new RequestOptions { EnableScriptLogging = true } );
Console.WriteLine(response.ScriptLog);
Run Code Online (Sandbox Code Playgroud)

你可以参考这个官方文档.

希望它能帮到你.