Variadic expressions have inconsistent query shapes

XMLWordPrintableJSON

    • Query Integration
    • Fully Compatible
    • ALL
    • 18
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      We noticed some interesting behavior for query shapes with variadic expressions (e.g. $multiply, $sum, etc). Here are some contrasting examples:

      db.c.aggregate([{$group: {_id: {$multiply: [1, 2, {$const: 3}]}}}]) 

      is simplified to

      {"$group": {"_id": {"$multiply": "?array<?number>"}}} 

      while 

      db.c.aggregate([{$group: {_id: {$multiply: [1, {$const: 1}, {$expr: {$sum: [1]}}]}}}]) 

      is generally preserved as

      {"$group": {"_id": {"$multiply": ["?number", "?number", "$myField", {"$sum": "?array<?number>"}]}}} 

      It's not clear what the desirable behavior here (there's a tradeoff between a possibly high cardinality of query shapes vs losing details of the user's original query), but it seems like the behavior between these two cases should not be so different.

              Assignee:
              Alyssa Clark
              Reporter:
              Alyssa Clark
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: