Add structcodec option equivalent to mgo's useJSONTagFallback

XMLWordPrintableJSON

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

      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 (Inactive)
            Reporter:
            Andrew Hodel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: