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

$quote operator

    XMLWordPrintable

    Details

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

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: