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

Convert BSONType into an enum class rather than a raw enum

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Storage Execution

      This would have major fallout across the codebase, but I think would improve things. I was just recently authoring a patch and ran across the following strange behavior.

      The correct way to build a BSON object with MinKey and MaxKey for testing is like so:

      BSON("" << MINKEY << "" << MAXKEY)
      

      But this code actually compiles also:

      BSON("" << MinKey << "" << MaxKey)
      

      After several minutes or maybe an hour of insanity, I realized that when I typed the second one I had actually constructed this object:

      {"": -1, "": 127}
      

      because it was reading from the BSONType enum and converting to an integer...

      I do not think I will be the last person to make this mistake in a test.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: