I’ve had a very frustrating time getting started with the NodeJS SDK. It appears that the documentation for the Node API is significantly incomplete. Here are some notes I’ve taken while trying to get some basic tasks done with the Node SDK:
If you get an error saying that “attachments are not supported in couchbase”, then check to make sure you don’t have _design/
at the front of your design doc name when building a query.
It appears that callbacks are called with exceptions when there’s a problem on the Javascript side of the operation, but they are called with an object or code when there’s an error on the C, or database side of the operation and the programmer must correlate that code with an enum in the source to understand what it means?
I just read that on the forum, but I don’t have the link handy. Here’s a related issue, though:
[…link erased because new users can only put two links in a post…]
It looks like an execution callback for a subdocument operation callback is being sent just an error code (a naked int) in the error parameter instead of an exception. This is not documented.
I would think that the documentation for the integer error code would appear here:
http://docs.couchbase.com/sdk-api/couchbase-node-client-2.1.4/MutateInBuilder.html#execute
but all that’s given the programmer is that the value passed to execute
should be a callback
. There’s no explanation of a deviation from the expected behavior of an exception as the first parameter to the callback, and there’s no indication that the result of the execution is a DocumentFragment
.
When dealing with document fragments specifically, the Node API will pass 1
to the callback’s error position if any of the fragments in the DocumentFragment
have errors in them. The programmer then has to visit each fragment in the contents
section of the DocumentFragment
object and access the error
field for a description and code. It looks like the description is included in the error, so no need to compare with the source code there.
The contents
and error
fields are not documented. I’d expect them to appear here: http://docs.couchbase.com/sdk-api/couchbase-node-client-2.1.4/DocumentFragment.html but I don’t see contents
in the list of methods or as fields on the class.
This has been a very frustrating experience. Is Node just a second-class citizen SDK? I’m guessing maybe the high-paying customers use the Java SDK mostly. I’m not trying to be cynical or accusatory. I’m hoping that you might either flesh out the documentation (and maybe make the API more consistent?) of the Node API, or if you don’t have time to do that, at least make a blaringly obvious note for users who are just getting started that they’ll probably have to do a lot of experimentation and discovery on their own with the current state of the Node documentation.
Or is there updated documentation somewhere that I’m missing?
Thanks! (Sorry I sound frustrated :\ )