Node.js N1ql Query Bug/Documentation Fix


#1

Had to go through some hoops in order to get N1ql queries working through the node client.


To start, the line from the documentation lists to enable N1ql with the following line:

myBucket.enableN1ql(['http://1.1.1.1:8093/','http://1.1.1.2:8093/']);

However, the Node.js SDK attaches http:// and /query anyways:

var uri = 'http://' + host + '/query';

So, in this example it should instead be entered:

myBucket.enableN1ql(['1.1.1.1:8093','1.1.1.2:8093']);

Otherwise it will attempt to access http://http://1.1.1.1:8093//query.


EDITED: I removed my second problem/fix as I see it’s fixed in the latest version of the code. The object model for the response changed in DP4 and I must have missed the update!


#2

Hey rpohlman,

Glad to see that you got the issue sorted out. In a short time, we will be getting the N1QL nodes list out of our cluster configuration system internally which will obviate the need to manually specify nodes. This is just a temporary function to allow you to use N1QL while it is still in beta!

Cheers, Brett