[GODRIVER-1114] RunCommandCursor always fails and returns an error message referencing internal driver details Created: 05/Jun/19  Updated: 28/Oct/23  Resolved: 20/Jun/19

Status: Closed
Project: Go Driver
Component/s: Command & Dispatch
Affects Version/s: 1.1.0
Fix Version/s: 1.1.0

Type: Bug Priority: Major - P3
Reporter: Aaron Szymanski Assignee: Emmanuel Eppinger (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File run_command_cursor.go    
Issue Links:
Cloners
is cloned by GODRIVER-2847 CLONE - RunCommandCursor always fails... Closed
Duplicate
is duplicated by GODRIVER-1134 Database.RunCommandCursor is not work Closed

 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.



 Comments   
Comment by Jacob Bills [ 13/May/23 ]

Just ran into this issue as well and its 2023

Comment by Githook User [ 21/Jun/19 ]

Author:

{'name': 'Emmanuel', 'email': 'manny.eppinger@mongodb.com', 'username': 'eppingere'}

Message: Fix command cursors so that they are able to accept commands

GODRIVER-1114

Change-Id: I9ccced4ccc5fac5ed972954d5249e4b3b5d37c8e
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/e4bd39d2c760255a391c8c0239833ee2ddb011c2

Comment by Emmanuel Eppinger (Inactive) [ 20/Jun/19 ]

https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/457956

Comment by Emmanuel Eppinger (Inactive) [ 13/Jun/19 ]

run_command_cursor.go

Comment by Emmanuel Eppinger (Inactive) [ 13/Jun/19 ]

https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/457956

Comment by Emmanuel Eppinger (Inactive) [ 13/Jun/19 ]

https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/457956

Comment by Emmanuel Eppinger (Inactive) [ 12/Jun/19 ]

So a fix is in the works but just as a heads up the command that you run must return a cursor. Ping doesn't return a cursor so that will always return an error.

Generated at Thu Feb 08 08:35:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.