-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
It would be really great if we were able to store MongoDB queries, query snippets, and atomic update directives in MongoDB itself. The problem right now is that, since field name with '$' are disallowed, one has to either string-encode or otherwise mangle the query JSON in order to store it in a document.
It seems like we could fix this by allowing '$' characters in field names and introducing a $quote operator (yes, Lisp inspired). Such an operator could be used as a way to disambiguate intent in a query (or update, etc...), and therefore eliminate the ambiguities that led to the need to disallow field names starting with '$'.
Example:
Let's say there exists a document, D, like this is used to store query contraint:
{ "_id" : 1234,
"constraint" : { "$lt" : 0 }}
The query:
{ "constraint" : { "$lt" : 0 }} would NOT match D (this query matches when documents where "constraint" < 0)
but this query:
{ "constraint" : { "$quote" : { "$lt" : 0 }}}} would match D
I'm sure there are other corner cases to think through, but this is the basic idea.
-will
- duplicates
-
SERVER-30575 Please add escaping convention for dot and dollar signs!
- Backlog
- is related to
-
SERVER-7996 Ability to disable checks for illegal collection names and keys
- Closed
-
SERVER-8436 Aggregation pipeline cannot process system.profile doc fields with $ prefixes
- Backlog
-
SERVER-10454 Do not store field names with "." in any metadata collections
- Closed
-
SERVER-3859 aggregation: if future updates use the aggregation expression syntax, are injection attacks a danger?
- Closed
- related to
-
SERVER-30287 Add $literal to the matcher
- Closed