Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-43840

Exclusion projection parser invariant trips on attempt to exclude reserved $-prefixed reserved field name

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide

      Any attempt to exclude one of the allowed $-prefixed path components will trigger this invariant:

      > db.c.aggregate([{$unset: "$db"}])
      > db.c.aggregate([{$project: {$ref: 0}}])
      > db.c.aggregate([{$project: {"$textScore": 0}}])
      
      Show
      Any attempt to exclude one of the allowed $-prefixed path components will trigger this invariant: > db.c.aggregate([{$unset: "$db" }]) > db.c.aggregate([{$project: {$ref: 0}}]) > db.c.aggregate([{$project: { "$textScore" : 0}}])
    • Query 2019-11-04
    • 7

      In previous versions of the server, all $-prefixed path components were disallowed in the aggregation framework and, in particular, were disallowed in exclusion projections. As part of SERVER-42421, however, we introduced several reserved $-prefixed key names which are legal. These include "$ref", "$db", and "$id", which constitute DBRefs, as well as names used by the system internally to store metadata such as "$recordId", "$sortKey", and so on.

      There is a lingering invariant in the exclusion projection parser which expects that the caller has rejected all $-prefixed field names. This invariant is no longer correct, since we permit certain reserved $-prefixed names as described above. We should remove or relax this incorrect invariant.

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: