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

Allow inline fields to be pointers of struct

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.0
    • Affects Version/s: 1.1.1
    • Component/s: BSON, CRUD
    • None

      Instant of Stock cannot be written because a pointer of Quantity struct is used inside it.
      type Quantity struct {
          InCarton float64 `json:"InCarton" bson:"InCarton"`
          InPallet float64 `json:"InPallet" bson:"InPallet"`
          InKg float64 `json:"InKg" bson:"InKg"`
          InCBM float64 `json:"InCBM" bson:"InCBM"`

      type Stock struct {
          Batch `json:",inline" bson:",inline"`
          Quantity *Quantity `json:",inline" bson:",inline"`
          MovementHistory Movements `json:"MovementHistory" bson:"MovementHistory"`
          CostPerKg `json:"" bson:""`

      Error message is described as below:

      panic: cannot transform type *simcel.TransportOrderLine to a BSON Document: (struct simcel.Stock) inline fields must be either a struct or a map

            Assignee:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Reporter:
            phuong.nguyen@cel-consulting.com Nguyen Phuong
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: