MongoConnection.runCommand

Runs the given Bson command (Bson object with the first entry in the map being the command name) on the given database.

Using runCommand checks that the command completed successfully by checking that result["ok"].get!double == 1.0. Throws the CommandFailException on failure.

Using runCommandUnchecked will return the result as-is. Developers may check the result["ok"] value themselves. (It's a double that needs to be compared with 1.0 by default)

class MongoConnection
@safe
Bson
runCommand
(
T
CommandFailException = MongoDriverException
)
(
string database
,
Bson command
,
string errorInfo = __FUNCTION__
,
string errorFile = __FILE__
,
size_t errorLine = __LINE__
)

Throws

- CommandFailException (template argument) only in the runCommand overload, when the command response is not ok. - MongoDriverException when internal protocol errors occur.

Meta