在 N1QL 语句中绑定第三个变量不起作用

Binding 3rd variable in N1QL statement doesn't work

目前这有效,它查询数据库和returns我们需要的JSON数据:

const QUERY: string = 'SELECT * FROM `default` where _type= and type=';
const params: string[] = [this.getSchema(), queryParams[0].key, queryParams[0].value];

但是,一旦我们将 type 替换为 </code>,查询 returns 就什么都没有了。 IE。这不起作用:</p> <pre><code>const QUERY: string = 'SELECT * FROM `default` where _type= and ='; const params: string[] = [this.getSchema(), queryParams[0].key, queryParams[0].value];

即使 的计算结果为 "type"

从 couchbase 返回错误:"An unknown N1QL error occurred. This is usually related to an out-of-memory condition."

使用动态查询而不是常量查询:

'SELECT * FROM `default` where _type= and ' + queryParams[0].key + '='