vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

Function MongoConnection.runCommand

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

Bson runCommand(T, CommandFailException) (
  string database,
  Bson command,
  string errorInfo = __FUNCTION__,
  string errorFile = __FILE__,
  size_t errorLine = __LINE__
);

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)

Throws

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

Authors

Sönke Ludwig

Copyright

© 2012-2016 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.