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

Allow storing aggregation pipelines as documents in MongoDB



    • Case:


      Currently it's not possible to store MongoDB's own aggregation pipelines due to the limitation that field names cannot start with a "$" symbol, and cannot contain a "." symbol either.

      For MongoDB to become the one-stop-shop for data storage, aggregation, massaging this is an unnecessary limitation that we should fix.

      Usage example: I want to build an app using custom / reusable aggregation pipelines that I can mix and match to get different views into my dataset.

      My current workaround is to replace all "$" symbols with "#" in MongoDB and recursively replace them back to "$" on the client. This is clumsy and expensive. I have not yet needed dot-notation fields.

      Two suggestions:
      a) either lift the limitations of storing field names with $-prefix and dots (could be escaped to not confuse with operators ($set, $push, etc), like

          "name": "my custom aggregation", 
          pipeline: [ {"\$match": {foo\.bar: 1} }, {"\$group": {_id: "bar", ...} } ],

      b) or offer an alternative aggregation reserved symbol (# instead of $). For this alternative, we could allow both for the time being to not break backwards compatibility. This doesn't solve the dotted field name problem however.


          Issue Links



              • Votes:
                1 Vote for this issue
                12 Start watching this issue


                • Created: