Using a $match and/or reference fields in DocumentDB causes Aggregation not supported error

703 views Asked by At

I have a what I consider to be a pretty straight forward search. I am developing it on MOngoDB locally but deploying it for DocumentDB on AWS. The function that I've written looks something like this:

if (searchCategory) {
    return [
        {
            $match: {
                $or: [
                    { title: params.searchString },
                    { description: params.searchString },
                    { workingNotes: params.searchString },
                ],
                active: true,
            },
        },
    ];
}

This query used to not have the $match statement around it and it worked fine, but something that we wanted to do was to use reference fields in our model for searching linked items as well. So we have something like this in our model:

        appendix: [{type: Schema.Types.ObjectId, ref: "document"}],

Now when I fire off the search query, I get an error back saying "Aggregation stage not supported: '$lookup on multiple join conditions and uncorrelated subquery.'"

Adding the reference field and the $match were the only changes made to the functionality, which worked before we added those.

Based off the documentation I've read about DocumentDB, the $match operator is supported, so it's possible I am missing something else about how to structure the query or handle the reference fields but I've been unable to determine what that might be.

Any help would be appreciated. Thanks!

0

There are 0 answers