Chris Hermut
Chris Hermut

Reputation: 1758

Azure documentdb stored procedure returning partial result

Currently I have got given stored procedure

function getData() {     
  var context = getContext();
  var collection = context.getCollection();

  var output = collection.map(function (doc) {
      return {
          id: doc.id,
          name: doc.name,
          status: doc.status,
          description: doc.description,
          owner: doc.owner
      }
  })

  return JSON.stringify(output)
}

Issue here is that it only returs 7 documents (matching what you get when you not get 'load' action on azure panel) and is skipping rest of the collection.

I believe that it can be fixed with using SQL query syntaxt but I would like to know how can I query all documents in the collection without using it.

Upvotes: 0

Views: 164

Answers (1)

Larry Maccherone
Larry Maccherone

Reputation: 9523

Try adding a FeedCallback like shown here and make the signature of the callback be function(error, resources, options). Look for errors. Also inspect the options parameter for a continuation. If that fails to give you enough information to fix the problem, then you might want to consider a more traditional query and transformation approach not using collection.map().

Upvotes: 1

Related Questions