diff --git a/lib/mongo/db.rb b/lib/mongo/db.rb index b080fdf..3969256 100644 --- a/lib/mongo/db.rb +++ b/lib/mongo/db.rb @@ -463,7 +463,7 @@ module Mongo result = Cursor.new(system_command_collection, :admin => admin, :limit => -1, :selector => selector, :socket => sock).next_document - if check_response && !ok?(result) + if result.nil? || (check_response && !ok?(result)) raise OperationFailure, "Database command '#{selector.keys.first}' failed: #{result.inspect}" else result diff --git a/lib/mongo/gridfs/grid_io.rb b/lib/mongo/gridfs/grid_io.rb index 6f6b8ee..0eb22ca 100644 --- a/lib/mongo/gridfs/grid_io.rb +++ b/lib/mongo/gridfs/grid_io.rb @@ -340,7 +340,7 @@ module Mongo md5_command = BSON::OrderedHash.new md5_command['filemd5'] = @files_id md5_command['root'] = @fs_name - @server_md5 = @files.db.command(md5_command)['md5'] + @server_md5 = @files.db.command(md5_command, false, true)['md5'] if @safe @client_md5 = @local_md5.hexdigest if @local_md5 != @server_md5