如何在documentdb中执行Javascript

时间:2015-07-13 16:40:04

标签: javascript asp.net azure-cosmosdb

如何在client.ExecuteStoredProcedureAsync()中执行此JS文件; 它不发送任何结果

function simple(UseID) {
  var collection = getContext().getCollection();


  var isAccepted = collection.queryDocuments(
    collection.getSelfLink(),
    "SELECT * FROM c where c.id='" + UseID +"'");
}

1 个答案:

答案 0 :(得分:2)

您需要在queryDocuments()的回调中设置存储过程响应。

例如:

function simple(UseID) {
    var collection = getContext().getCollection();


    var isAccepted = collection.queryDocuments(
        collection.getSelfLink(),
        "SELECT * FROM c where c.id='" + UseID + "'",
        {},
        function(err, documents, responseOptions) {
            getContext().getResponse().setBody(documents);
        });
}