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

Err: cannot transform type bson.D to a BSON Document

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None

      As part of mgo->go driver migration, I found weird failures in evg: 
      https://evergreen.mongodb.com/version/5c75aecd2fbabe2eb0b55062 . 
      more specifically the error: 

      Err: cannot transform type bson.D to a BSON Document: WriteArray can only write a Array while positioned on a Element or Value but is positioned on a TopLevel

      The code caused this error: 
      session.Database("admin").RunCommand(context.Background(), bson.D{{"buildInfo", int32(1)}}).Decode(&result)

      (https://github.com/10gen/mms-backup/pull/317/commits/7b5323541e89a0fb77609ecdea9c99469f31e3af)

      By changing bson.D{{"buildInfo", int32(1)}} to bson.M

      {"buildInfo" : int32(1)}

      the error went away. 

      Can you please take a look? thanks!

      Note: no mgo imported nor deps installed

       

            Assignee:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Reporter:
            xiang.gao@mongodb.com Xiang Gao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: