azure documentdb - Unable to queryDocuments using a CosmosDb Sproc -
i attempting create sproc in cosmosdb collection, unable execute query shown in examples:
- querydocuments api - https://azure.github.io/azure-documentdb-js-server/collection.html
- example using querydocuments - https://github.com/azure/azure-documentdb-js-server/blob/master/samples/stored-procedures/simplescript.js
i wrote own sproc based off of simplescript.js looks like
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 * root r"},callback); }
i'm using documentdbstudio 0.72 create sproc, , run it. response body (from setbody in callback function):
{"currentcollectionsizeinmb":"documentsize=0;documentssize=98;documentscount=14;collectionsize=101;","maxcollectionsizeinmb":"documentsize=0;documentssize=98;documentscount=14;collectionsize=101;"}[]
how create such select * sproc?
thanks
i took script , worked on side.
so, double check whether have docs in collection using query explorer in azure portal.
Comments
Post a Comment