• Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying, Storage

      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

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            will@objectlabs.com Will Shulman
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: