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

RunCommandCursor always fails and returns an error message referencing internal driver details

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 1.1.0
    • 1.1.0
    • Command & Dispatch
    • None

    Description

      Example code:

      	_, err := client.Database("mydb").RunCommandCursor(nil, bson.D{
      		{"explain", bson.D{{"find", "mycollection"}}},
      		{"verbosity", "executionStats"},
      	})
      

      This simpler example fails in the same way:

      	_, err := client.Database("mydb").RunCommandCursor(nil, bson.D{
      		{"ping", 1},
      	})
      

      Error:

      cursor should be an embedded document but is of BSON type invalid
      

      It's quite possible that i'm just doing something wrong. In which, case the bug is just that the error message does not indicate what I did wrong. However, im pretty sure there's a real bug here preventing this from working.

      I see that `RunCommandCursor` calls `ResultCursor`, which calls `NewCursorResponse` with `c.result`. `c.result` only appears to ever be set by `Execute` which, is never called. `NewCursorResponse` then returns the above error when it tries to verify the type of the "cursor" field on a nil document.

      Attachments

        1. run_command_cursor.go
          0.8 kB
          Emmanuel Eppinger

        Issue Links

          Activity

            People

              manny.eppinger@mongodb.com Emmanuel Eppinger (Inactive)
              aaronszy Aaron Szymanski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: