2017-10-31 13 views
1

https://github.com/Azure/azure-documentdb-js-server/blob/master/samples/stored-procedures/bulkDelete.js)のストアドプロシージャを実行したいとします。これを実行するには、クエリをパラメータとして渡す必要があります。私のクエリは 'SELECT VALUE(c._self)FROM cのようになります。c._ts < =' +(new Date()。setFullYear(new Date()。getFullYear() - 1))/ 1000。Cosmos DBスクリプトエクスプローラのストアドプロシージャのパラメータとしてクエリを渡す方法

上記のsp(リンクに記載されています)をパラメータとして実行すると、その例外がスローされます。 spは関数の計算を行うため、上記のクエリをパラメータとして受け入れていないためです。

誰も私にどのようにパラメータとして上記のクエリを渡すことができます私を提案することができます。

+0

返される実際のエラーメッセージは何ですか? –

答えて

0

あなたの質問に見られるように、 "二重引用符"が欠けているので、

詳細は以下の通りです:

必要なもの "スクリプト・エクスプローラー" たとえば

All explorers in document db are: 
    "Data Explorer" 
    "Document Explorer" 
    "Query Explorer" 
    "Script Explorer" 

Click on "Script Explorer" (scroll down, it will be below "Data Explorer") 
select Database on right 
select Collection on right 
then Stored Procedure you want to execute 
then on the right there is: 
    "Inputs" 
     give your query like here 
    "Results" 
     see detailed error here 

です:

Inputs: 
    SELECT c._self FROM c 
Results: 
    Invalid inputs. Please ensure that the "Inputs" field contains a valid JSON value. 

Inputs: 
    'SELECT c._self FROM c'  
Results: 
    Invalid inputs. Please ensure that the "Inputs" field contains a valid JSON value. 

Inputs: 
    "SELECT c._self FROM c" 
Results: 
    {"deleted":5,"continuation":false} 

ので、
1.まず、2例があるためそこに失敗しました。引用符がないか、一重引用符で囲まれています。
2.二重引用符があるため、3番目に合格しました。

希望に役立ちます。

関連する問題