With the tutorial sample bucket data, I’m seeing something odd with the IN operator.
This query works fine, returning 4 documents:
SELECT *
FROM tutorial
WHERE age IN [46,18,56]
However, if I add another “where” clause, the “IN” no longer seems to work - e.g.:
SELECT *
FROM tutorial
WHERE age IN [46,18,56]
AND email LIKE ‘%@gmail.com’
This returns no results, though it ought to return the same 4.
I can work around this by using (age=46 or age=18 or age=56), so not a big deal, but the IN operator would be cleaner.
I’m I doing something wrong here, in my use of “IN”, or is there a bug? Cheers!
I have a similar issue using the IN operator. I can confirm everything works with a multi-WHERE statement (eg. … WHERE type=“patient” AND org.id IN [207,209]). I’m using DP4.
However, when I create an index on the “type” column:
CREATE INDEX indexType ON default(type);
Then try to execute a N1QL query using a multi-WHERE and IN statement, nothing every returns. The cbq hangs and I have to kill it and come back in.
Here is the example select statement:
SELECT patient.lastName, patient.firstName FROM default WHERE type=“admission” AND org.id IN [207,209];
Separately, if I create an index on org.id:
CREATE INDEX indexOrgId ON default(org.id);
Then run a single WHERE statement, everything works:
SELECT * FROM admission WHERE org.id IN [207,209];
So, it looks like it only involves multi-WHERE clauses that invokes and Index.