Provides a helper to run specified database commands. This is the preferred method to issue database commands, as it provides a consistent interface between the shell and drivers.
Parameter Type Description
document or string “A database command, specified either in document form or as a string. If specified as a string,
db.runCommand()transforms the string into a document.”
New in version 2.6: To specify a time limit in milliseconds, see Terminate Running Operations.
db.runCommand() runs the command in the context of the
current database. Some commands are only applicable in the context of
admin database, and you must change your
db object to
before running these commands.