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

Add structcodec option equivalent to mgo's useJSONTagFallback

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: 1.3.5
    • Component/s: BSON
    • Labels:
    • Environment:
      Linux 4.9, Mongo 3.6.14

      NEW DESCRIPTION

      mgo supports a non-default option to fallback to using json tags for structs when bson tags aren't present, so an option should be added to StructCodec to do the same.

       

      PREVIOUS DESCRIPTION

      Basically if you have a struct that has something like:

       

      ```

      WsId         string      `json:"ws_id"`

      ```

       

      Running find() on a collection will not return the ws_id field for the document, but if you define the struct as:

       

      ```

      Ws_Id         string      `json:"ws_id"`

      ```

       

      It will work.

       

      Read this - https://github.com/golang/go/issues/40351

            Assignee:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Reporter:
            andrewhodel@gmail.com Andrew Hodel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: