我正在使用Couchbase Server(4.5 Enterprise)节点SDK(v2.3.0)执行一些N1QL。
当我打开Couchbase Web Workbench执行以下N1QL时,一切都很好。
SELECT meta().id, * FROM `Sample-Bucket` where owner != 'userid' AND recycled IS MISSING AND ANY g IN groups SATISFIES g = 'groupid' END
当我使用节点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);
})
我收到以下错误:
{ [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: [] } }
有什么想法?
我认为,在准备好的语句中编码计划中某些运营商的问题是一个已知问题。我也在Couchbase论坛上回答了这一点。