Minimal example:
(function() { db.c.insert({_id: 1, num: NumberDecimal("infinity")}); const pipe = [{$match: {"num": {$bitsAnyClear: 11111000}}}]; let explain = db.c.explain().aggregate(pipe); if (explain.queryPlanner.winningPlan.slotBasedPlan) { print("EXPLAIN: \n" + explain.queryPlanner.winningPlan.slotBasedPlan.stages); } print("RESULTS: " + tojson(db.c.aggregate(pipe).toArray())); })();
This pipeline gives different results between SBE and classic. Classic returns the document, while SBE does not. According to our documentation, $bitsAnyClear will not match values which can't be represented in a 64 bit integer (See "floating point" section of the page). SBE's behavior matches the documentation (hence I'm not marking this as a "bug" ticket).
There is a note in some of the SBE stage builder code that we try to match classic's behavior despite the documentation (see here).