Search code examples
node.jscouchbasecouchbase-nodejs-sdk

Couchbase Node SDK Error: JSON unmarshalling error: No operator for name DistinctScan


I am using Couchbase server(4.5 Enterprise) Node SDK(v2.3.0) to execute some N1ql.

When I open couchbase web workbench to execut the following N1ql, all works fine.

SELECT meta().id, * FROM `Sample-Bucket` where owner != 'userid' AND recycled IS MISSING AND ANY g IN groups SATISFIES g = 'groupid' END

While when I use node sdk,

const QUERY  = 'SELECT meta().id, * FROM `Sample-Bucket` where owner != $userid AND recycled IS MISSING AND ANY g IN groups SATISFIES g = $groupid END'

let query = n1ql.fromString(QUERY).adhoc(false);

    params = {
        userid: 'userid',
        groupid: 'groupid'
    };

cluster.executeN1ql(query, params, (err, results) => {

    console.log(err);
})

I receive the following error:

{ [ErrInternalError: Unexpected Database Error]
status: 500,
message: 'Unexpected Database Error',
name: 'ErrInternalError',
_trace: true,
_cause: 
 { [Error: Unable to decode prepared statement - cause: Unrecognizable    prepared statement - cause: JSON unmarshalling error: No operator for name DistinctScan]
 requestID: '2d3d28f9-7298-4d4f-93f8-cd35aab04077',
 code: 4070,
 otherErrors: [] } }

Any ideas?


Solution

  • I think this is a known issue with certain operators in the encoded plan in prepared statements. I've also answered this on the Couchbase Forums.