• Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • Hide
      db.a.drop()
      db.a.insertOne({})
      db.a.createIndex({a:1, b:1})
      db.a.aggregate([{$sort: {a: 1}}, {$limit: 10}, {$addFields: {t: {$type: "$b"}}}, {$project: {_id: 0, t: 1}}]) 

      Returns [

      {t: 'null'}

      ] even though the real type is missing, which is what the pipeline returns without the index.

      Show
      db.a.drop() db.a.insertOne({}) db.a.createIndex({a:1, b:1}) db.a.aggregate([{$sort: {a: 1}}, {$limit: 10}, {$addFields: {t: {$type: "$b" }}}, {$project: {_id: 0, t: 1}}]) Returns [ {t: 'null'} ] even though the real type is missing, which is what the pipeline returns without the index.
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-133440 disabled the pushdown of synthesized projections for pipelines with presence-sensitive match expressions, as pushing down a projection may cause the find query to be covered by an index, which conflate missing vs null (SERVER-23229).

       

      This is the follow-up to also disable such pushdowns for presence-sensitive aggregation expressions.

            Assignee:
            Unassigned
            Reporter:
            Kartal Kaan Bozdogan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: