Check for nil response in db#command and set check_response for filemd5.

Kyle can we make check_response default to true instead of false?
This commit is contained in:
Mike Dirolf 2010-05-11 13:03:47 -04:00
parent edd8a7104f
commit 60ffbb2706
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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