0
votes

I'm trying to use the "readCollection" function, but I get an Error:

The "options" parameter must be of type "object". Actual type is: "function".

my code:

docDbClient.readCollection(docUrl, function (err, collection) {
   console.log(collection);
}, function(err){
    console.log(err);
});

The docUrl var is equal to my document._self path.

This code was working before, but for some reason it not anymore without me making any changes.

From what the error says the 'option' parameter needs to be an object instead of a function, but from what I read on the documentation the 'option' parameter is optional which I don't have it with in my function.

I'm also getting the same error when I use the replaceDocument function.

http://azure.github.io/azure-documentdb-node/DocumentClient.html#readCollection

1

1 Answers

0
votes

The problem is that you have an error handling function in your parameter list, which causes it to think that the second parameter is options. Remove the error handling function, and add code inside your main handler to process it if err does not come back null.