azure documentdb - Unable to queryDocuments using a CosmosDb Sproc -


i attempting create sproc in cosmosdb collection, unable execute query shown in examples:

  1. querydocuments api - https://azure.github.io/azure-documentdb-js-server/collection.html
  2. 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.

enter image description here

so, double check whether have docs in collection using query explorer in azure portal.

enter image description here


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -