Database object
connect database
this method is deprecated, use init to initiate a new database
Disconnect to database
>>> Database.disconnect()
Issue a MongoDB command.
Send command command to the database and return the response. If command is an instance of basestring then the command {command: value} will be sent. Otherwise, command must be an instance of dict and will be sent as is.
Any additional keyword arguments will be added to the final command document before it is sent.
For example, a command like {buildinfo: 1} can be sent using:
>>> db.command("buildinfo")
For a command where the value matters, like {collstats: collection_name} we can do:
>>> db.command("collstats", collection_name)
For commands that take additional arguments we can use kwargs. So {filemd5: object_id, root: file_root} becomes:
>>> db.command("filemd5", object_id, root=file_root)
Parameters: |
|
---|