当仅使用IN运算符时,以下查询工作正常 SELECT META().id FROM bucket_name WHERE description IN ['Item1','Item2']
SELECT META().id FROM bucket_name WHERE description IN ['Item1','Item2']
但是当我触发这个查询时,它给我一个空白的结果 SELECT META().id FROM bucket_name WHERE id = 123 AND description IN ['Item1','Item2']
SELECT META().id FROM bucket_name WHERE id = 123 AND description IN ['Item1','Item2']
我是在做错事还是其他人遇到了同样的问题?
我认为您必须将“ IN”条件放在括号中才能使其起作用:
SELECT META().id FROM bucket_name WHERE id = 123 AND (description IN ['Item1','Item2'])
它与N1QL处理器评估操作员的优先级有关
如果使用EXPLAIN关键字运行它,它将显示它如何相互链接条件。
例如
explain SELECT META().id FROM bucket_name WHERE id = 123 AND (description IN ['Item1','Item2'])
与
explain SELECT META().id FROM bucket_name WHERE id = 123 AND description IN ['Item1','Item2']