In response to your comment that you received an exception from the “bad option” message, it turns out that the server is picky whether you use 1 or true value of the repairDatabase field. The following two equivalents and both fail because the server does not like "true" instead of "1":
database.RunCommand("repairDatabase");
database.RunCommnad(new CommandDocument("repairDatabase", true));
but it works:
database.RunCommnad(new CommandDocument("repairDatabase", 1));
You can tell JIRA about the server if this bothers you:
https://jira.mongodb.org/browse/SERVER
source
share