Details
-
Bug
-
Resolution: Fixed
-
Critical
-
4.5.1, 5.0.0
-
None
-
Untriaged
-
Unknown
Description
https://forums.couchbase.com/t/n1ql-array-indexing-empty-arrays-and-querying-meta-id/9491/5
insert into default values ("101", { "docType": "Test", "tags": [], "title": "doc101" });
|
insert into default values ("102", { "docType": "Test", "tags": [ "tag1" ], "title": "doc102" });
|
insert into default values ("103", { "docType": "Test", "tags": [ "tag1", "tag2" ], "title": "doc103" });
|
insert into default values ("104", { "docType": "Test", "tags": null, "title": "doc104" });
|
CREATE INDEX ix02 ON `default`(docType, tags, DISTINCT ARRAY t FOR t IN tags END, title) WHERE docType="Test";
|
SELECT META().id,title from default WHERE docType="Test”;
|
--For key 101 title is missing
|
Indexer returns the following values. As you see key 101 has only 3 elements and index has 4 keys. 3rd key is missing and we interpret 4th as 3rd.
Are we need to return null of array expression if there are no elements?
[Test [] doc101] ... 101
[Test [tag1] tag1 doc102] ... 102
[Test [tag1 tag2] tag1 doc103] ... 103
[Test [tag1 tag2] tag1 doc103] … 103
[Test null null doc104] ... 104