-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Usability
-
None
-
Query Optimization
-
(copied to CRM)
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
db.foo.insert({ "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.
- is related to
-
SERVER-8436 Aggregation pipeline cannot process system.profile doc fields with $ prefixes
- Backlog
- related to
-
SERVER-30575 Please add escaping convention for dot and dollar signs!
- Backlog