Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • # Replies:
      3
    • Last comment by Customer:
      true

      Description

      I happened to be perusing the BSON spec (http://bsonspec.org) and saw this:

      element ::= [ ... ]

      "\x0E" e_name string Symbol

      The mouseover tip says: "SYMBOL: Similar to a string but for languages with a distinct symbol type."

      The Ruby driver does not implement the Symbol type in any way distinct from String. If you save a document {:foo => "bar"} to Mongo and then query it again, you'll get back

      {"foo" => "bar"}

      .

      Given how fundamental symbols are as hash keys in idiomatic Ruby, it would be a very positive step forward for code convenience and a more transparent persistence layer if symbols could be saved to MongoDB as symbols.

      This change should not have much negative impact on existing applications, because code that's been translating symbols to strings this entire time will continue to do so. Only code that's reliant on inconsistency (i.e., that puts symbols in and explicitly relies on strings back out) would be fragile. Given that the symbol-to-string mapping is not documented in the API, I consider that to be relying on a bug.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                7 years, 21 weeks ago
                Date of 1st Reply: