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

View File

@ -120,6 +120,18 @@ module Mongo
single_db_command(name, :dropDatabase => 1) single_db_command(name, :dropDatabase => 1)
end 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. # Return the build information for the current connection.
def server_info def server_info
db("admin").command({:buildinfo => 1}, {:admin => true, :check_response => true}) db("admin").command({:buildinfo => 1}, {:admin => true, :check_response => true})