[CSHARP-478] RunCommand("repairDatabase") throws an exception Created: 28/May/12 Updated: 02/Apr/15 Resolved: 06/Jun/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.4.2 |
| Fix Version/s: | 1.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Roman Kuzmin | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
The following command database.RunCommand("repairDatabase") throws the exception: Message=Command 'repairDatabase' failed: bad option (response: { "errmsg" : "bad option", "ok" : 0.0 }) Just a guess. If I use `1` instead of `true` in the C# driver code below then the command works. MongoDatabase.RunCommandAs(Type commandResultType, string commandName) var command = new CommandDocument(commandName, true); // guess: perhaps `1` should be used, not `true` At least, if we take a look at the definition of runCommand in the shell then we see that 1 is used: > db.runCommand The full program code (very trivial) is attached. |
| Comments |
| Comment by Robert Stam [ 06/Jun/12 ] | ||
|
Changed the default for commands to { commandName : 1 }. | ||
| Comment by Robert Stam [ 29/May/12 ] | ||
|
FYI, the Java driver uses true also instead of 1. There are very few commands that don't accept true. | ||
| Comment by Robert Stam [ 29/May/12 ] | ||
|
Yes, it probably would. Here's an easy workaround in the meantime:
| ||
| Comment by Roman Kuzmin [ 29/May/12 ] | ||
|
I see. But the shell uses 1. It makes sense perhaps to use 1 in the driver as well. | ||
| Comment by Robert Stam [ 29/May/12 ] | ||
|
Thanks for reporting this. The server normally accepts either 1 or true as the value of command names, but every now and then a command is picky and refuses one or the other. |