BugZero found this defect 60 days ago.
Data sources
All data on this page is proprietary to BugZero® or gathered from public sources
3/20/2024
MongoDB Server
No affected releases provided.
No fixed releases provided.
Tripwire assertion error: {'code': 7349401, 'codeName': 'Location7349401', 'errmsg': 'Was not able to re-parse queryStats key when reading queryStats.Status Location17390: $group does not support inclusion-style expressions Hash: 1070139331129839062 Query Shape: { cmdNs: { db: "test", coll: "jstests_indexu_NaN" }, command: "aggregate", pipeline: [ { $group: { _id: { by: 1 }, count: { $sum: 1 } } }, { $sort: { count: -1 } } ] }'} location: {fileName:"src/mongo/db/pipeline/document_source_query_stats.cpp", line:255, functionName:"toDocument"} The failing query: db.c.aggregate([{ $sortByCount: { $expr: { 'by': 22 } } }]) which desugars to db.c.aggregate([{ $group: { _id: {$expr: { 'by': 22 }, count: { $sum: 1 } } }, { $sort: { count: -1 } } ]) It's hitting this assertion. This is happening because when we parse $expr: { 'by': 22 } we drop the $expr and by: 22 looks like a group expression on the field name "by" with the expression being "22". This is not allowed per the assertion we hit. What we really want is pre-SERVER-84159 behavior that serializes constant expressions with $const in the representative shape so that they are not interpreted as raw constants in cases when that's not allowed during the re-parsing step.