[GODRIVER-573] Need ability to run a command and get back a cursor Created: 19/Sep/18  Updated: 17/Jan/19  Resolved: 17/Jan/19

Status: Closed
Project: Go Driver
Component/s: Administrative Commands
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: David Golden Assignee: David Golden
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The mongo tools need the ability to create a cursor from an arbitrary command (e.g. repairCursor).

Creating it manually is difficult as cursor building is buried in the core/topology package and requires a lot of private details (e.g. which server to go back to for getMore).

Could we add a "RunCursorCommand" method that takes an arbitrary command to run and returns a cursor object?



 Comments   
Comment by David Golden [ 17/Jan/19 ]

Duplicate of GODRIVER-437

Comment by Kristofer Brandow (Inactive) [ 24/Sep/18 ]

I think this is something we can support. It'll be unwieldy for users to build their own cursors from commands that return cursors. Users can still do so by running RunCommand, but if a user just wants to run a command that returns a cursor I think it makes sense to allow that.

Comment by David Golden [ 21/Sep/18 ]

I spoke with Eric M. and he says repair cursors are only for mmapv1. However, we still need to support older servers with mmapv1, so we still need this feature for tools.

Comment by David Golden [ 19/Sep/18 ]

It came in 2.7 as tools changed to no longer work directly against database files, so I suspect it's Wired Tiger or generic-storage-abstraction related. The server ticket for it was SERVER-15544.

Comment by Jeffrey Yemin [ 19/Sep/18 ]

Yeah, I don't like that either. I thought there was a more general way of doing this in mgo, but I don't see it.

Is repairCursor only for mmapv1? There's no documentation about that one way or the other.

Comment by David Golden [ 19/Sep/18 ]

mgo provides a Repair method directly on Collection. I don't think we should copy that because I don't think we want to encourage users to rely on it, as it's one of those underdocumented commands that only works sometimes (e.g. for some storage engines).

I think a more general purpose method will serve us better in the long run.

Comment by Jeffrey Yemin [ 19/Sep/18 ]

Remind me how this is done in mgo, as a point of comparison.

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