-
Type: Bug
-
Status: Resolved
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 10.10, 2021
-
Fix Version/s: 10.10-HF65, 2021.25
-
Component/s: Core MongoDB
-
Release Notes Summary:Query with complex correlation for schemas with no prefix now works on mongodb
-
Tags:
-
Backlog priority:900
-
Sprint:nxplatform #68
-
Story Points:2
When running a query similar to the following against MongoDB, no results are returned
SELECT * FROM Document WHERE files:files/*1/file/name LIKE '%.png' and files:files/*1/file/length > 0
even though a document exists with these properties.
"files:files": [ { "file": { "name": "image.png", "mime-type": "image/png", "encoding": null, "digestAlgorithm": "MD5", "digest": "2b42ab32ba681ebd48e4864a4797f243", "length": "268948", "data": "http://localhost:8080/nuxeo/nxfile/default/7fe1bd77-555d-4bd2-8a50-aa6764a3bf26/files:files/0/file/image.png?changeToken=10-0" } } ],
If the following is run
SELECT * FROM Document WHERE files:files/*1/file/name LIKE '%.png'
or
SELECT * FROM Document WHERE files:files/*1/file/length > 0
the document is returned. Below is the request sent to MongoDB
2022-08-04T14:26:16,576 TRACE [http-nio-0.0.0.0-8080-exec-8] [org.nuxeo.ecm.core.storage.mongodb.MongoDBRepository] MongoDB: QUERY Document{{$and=[Document{{files:files=Document{{$elemMatch=Document{{$and=[Document{{files.file.name=\.png$}}, Document{{files.file.length=Document{{$gt=0}}}}]}}}}}}, Document{{ecm:primaryType=Document{{$in=[OrderedFolder, TaskRoot, TemplateRoot, AssetsSearch, DocumentRouteModelsRoot, TaskDoc, UserProfile, SavedSearch, AdvancedContent, PermissionsSearch, UserInvitationContainer, CommentRoot, UserWorkspacesRoot, DocumentRouteStep, Document, Folder, WorkspaceRoot, BasicAuditSearch, RoutingTask, Picture, UserInvitation, Collections, StepFolder, PictureBook, Comment, DocumentRouteInstancesRoot, RouteNode, DefaultSearch, DocumentRoute, AdministrativeStatus, SectionRoot, HiddenFolder, Section, AdministrativeStatusContainer, Annotation, ExpiredSearch, ConditionalStepFolder, Video, Note, Collection, AdvancedSearch, Tag, Domain, Audio, File, ManagementRoot, Favorites, Workspace]}}}}]}} KEYS Document{{ecm:id=1.0, ecm:parentId=1.0, ecm:name=1.0}}
MongoDB document json attached.
Also see this issue when searching on picture:views