Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2060

Golang decode doesn't work with interfaces

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Gone away
    • Icon: Unknown Unknown
    • None
    • None
    • None

    Description

      When unmarshaling objects in Go, you can't pass in an interface, however it works when unmarshaling json.

       

      ```

      type X interface {}

      type Y struct {}

       

      var z X

      z = &Y{}

       

      d.Decode(z) // works in json, not with bson.

      ```

       

      This is severely limiting for what we can do with the API

      Attachments

        Activity

          People

            matt.dale@mongodb.com Matt Dale
            teeling.sean@gmail.com Sean Teeling
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: