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

Special Characters in Property Names

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Minor - P4
    • Resolution: Works as Designed
    • None
    • None
    • None
    • Fully Compatible

    Description

      I'd like to see mongodb add support for special characters in field names. By special characters, I'm referring to the ascii classics such as ?, !, #, @, %, ^, and *. If that list is a bit daunting, then the main use case I have involves the question mark. In Ruby, as you may know, names, such method or variable names, can end in a question mark. The purpose of the question mark ties into the language slightly, but once you get use to and use some other data system which doesn't support the question mark, you really miss its expressiveness. In Ruby, if the convention is followed, it tells you at a glance if a name represents a predicate (true or false), or some other data. If your thinking a simple question mark serves no other purpose than offering syntactic sugar, think again, as it's semantic power shouldn't be underestimated. Here are some examples:

      paid: 'Credit Card'
      paid?: true

      red?: false
      red: 'A vibrant color'

      I'm not suggesting you'd ever use near identical property names like that, but it highlights how the property names 'paid' and 'red' can each represent completely different types of data, and how the use of the question mark can clarify the properties meaning or context. It sure beats the likes of 'has_paid' and 'is_red'. It's a shame that special characters are so feared in the world of syntax.

      I'd just ask that including the question mark, if not other special characters, be considered.

      Attachments

        Activity

          People

            Unassigned Unassigned
            wardrop Tom Wardrop
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: