Merge branch 'master' of git://github.com/voodootikigod/mongo-ruby-driver into dbcopy

This commit is contained in:
Kyle Banker 2009-11-04 11:44:19 -05:00
commit ba51e345f9
1 changed files with 12 additions and 0 deletions

View File

@ -120,6 +120,18 @@ module Mongo
single_db_command(name, :dropDatabase => 1)
end
# Copys the database +from+ on +host+ to +to+ on the executing server.
# +host+ is optional and will use localhost host if no value is provided.
def copy_database( from, to, host="localhost" )
oh = OrderedHash.new
oh[:copydb]= 1
oh[:fromhost] = host
oh[:fromdb] = from
oh[:todb] = to
single_db_command('admin', oh)
end
# Return the build information for the current connection.
def server_info
db("admin").command({:buildinfo => 1}, {:admin => true, :check_response => true})