【发布时间】:2017-07-27 22:57:40
【问题描述】:
我正在尝试在我的 cosmosdb 集合中创建存储过程,但无法成功执行示例中所示的任何查询:
- QueryDocuments api - https://azure.github.io/azure-documentdb-js-server/Collection.html
- 使用 QueryDocuments 的示例 - https://github.com/Azure/azure-documentdb-js-server/blob/master/samples/stored-procedures/SimpleScript.js
我基于 SimpleScript.js 编写了自己的存储过程,看起来像
function() {
function callback(err, docs, opt)
{
if (err) getContext().getResponse().setBody(JSON.stringify(err));
else getContext().getResponse().setBody(JSON.stringify(opt).concat(JSON.stringify(docs)));
}
var collection = getContext().getCollection();
var collectionLink = collection.getSelfLink();
var x = __.queryDocuments(__.getSelfLink(),{ query: "select * from root r"},callback);
}
我正在使用 DocumentDbStudio 0.72 创建存储过程并运行它。 这是我得到的响应体(来自回调函数中的 setBody):
{"currentCollectionSizeInMB":"documentSize=0;documentsSize=98;documentsCount=14;collectionSize=101;","maxCollectionSizeInMB":"documentSize=0;documentsSize=98;documentsCount=14;collectionSize=101;"}[]
如何成功创建这样的 Select * sproc?
谢谢
【问题讨论】:
标签: azure-cosmosdb