
OPERATIONAL DEFECT DATABASE
...

...
Between 7.0 and 8.0, the behavior of queries containing components like {$documents: {$function: {body: function (arg) {return arg;}, args: [ array: [ /regex with an escaped \/ character/ ] ], land: "js" } } } changed when sent through OpMsgRequest. In 7.0, the \/ is output correctly, but in 8.0, the \/ becomes a / (the escaping backslash is itself escaped). This does not occur in 8.0 without the nesting, e.g. {$documents: {$function: {body: function (arg) {return arg;}, args: [ regex: /regex with an escaped \/ character/ ] ], land: "js" } } } or {$documents: [ { array: [ /regex with an escaped \/ character/ ] } ] } Further investigation reveals that, compared to using mongosh, the received queries differ. The mongosh query sends an escaped two-character \/ substring, whereas the OpMsgRequest query sends a one-character / substring. Fully reproducing this behavior will likely rewrite writing a test or toy program of some sort in 7.0 to send the right kind of query and observing the received query on the other side. Given that $function is deprecated, it's likely that this is not altogether terribly important – or it might even be fixed by SERVER-98936.
Click on a version to see all relevant bugs
MongoDB Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.