Add a way to unmarshal BSON to map[string]any

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Won't Do
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Go Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Go Driver v2 changed the default decoding for documents to bson.D from map[string]any, which was the default in v1. You can get close to the old behavior by creating a new decoder and setting DefaultDocumentM() on it. That's not quite the same, though, because it decodes to bson.M and not map[string]any. (bson.M has map[string]any as its underlying type, but it isn't strictly an alias.)

      This short program demonstrates the difference. Upgrading to v2 causes some mongosync tests to fail because they expect a map[string]any and are now getting a bson.M. (I can plausibly update the failing tests, but we prohibit bson.M in general in mongosync, so that linting rule will require an update.)

            Assignee:
            Preston Vasquez
            Reporter:
            Michael McClimon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: