DocumentDB readCollection 函数错误

DocumentDB readCollection function error

我正在尝试使用 "readCollection" 函数,但出现错误:

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

我的代码:

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

docUrl 变量等于我的 document._self 路径。

此代码以前可以工作,但由于某种原因,如果我不做任何更改,它就不再工作了。

根据错误的说法,'option' 参数需要是一个对象而不是函数,但是根据我在文档中阅读的内容,'option' 参数是可选的,我没有它在我的函数中。

我在使用 replaceDocument 函数时也遇到同样的错误。

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

问题是你的参数列表中有一个错误处理函数,导致它认为第二个参数是options。删除错误处理函数,并在主处理程序中添加代码以在 err 未返回 null 时对其进行处理。