Doc-Cirrus/orthanc-mongodb

AET that worked with orthanc core 1.5.7, no longer working with orthanc core 1.8.x

Closed this issue · 2 comments

{$match: {resourceType: 1}}, {
            $lookup: {
                as: "sorts",
                from: "MainDicomTags",
                let: {resource: "$internalId"},
                pipeline: [
                    {
                        $match: {
                            $expr: {$eq: ["$id", "$$resource"]},
                            $or: [{tagGroup: 8, tagElement: 32}, {tagGroup: 8, tagElement: 48}]
                        }
                    }]
            }
        }, {$sort: {sorts_0_value: -1, sorts_1_value: -1}}, {
            $graphLookup: {
                from: "Resources",
                startWith: "$internalId",
                connectFromField: "internalId",
                connectToField: "parentId",
                as: "children"
            }
        }, {$unwind: "$children"}, {$match: {children_resourceType: 3}}, {
            $group: {
                _id: "$publicId",
                instance_id: {$first: "$children.publicId"}
            }
        }]

Queries such as the above are taking longer than the timeout value, in the above case: 149176ms

Strangely this was not a problem with Orthanc 1.5.7.

@ooskapenaar I suggest you to try my fork of the repos cuz I moved away from this Implementation (not optimized)

Improving the indexes fixed this issue. Unfortunately there are other issues, I am opening another ticket.

@Betalos thanks for the hint. I will continue the conversation in your PR.