warn if index fails to create

This commit is contained in:
Kyle Banker 2010-02-25 16:40:35 -05:00
parent c0e8a525bd
commit 824573f297
1 changed files with 5 additions and 1 deletions

View File

@ -338,7 +338,11 @@ module Mongo
:ns => "#{@db.name}.#{@name}", :ns => "#{@db.name}.#{@name}",
:key => field_h, :key => field_h,
:unique => unique } :unique => unique }
insert_documents([sel], Mongo::DB::SYSTEM_INDEX_COLLECTION, false) begin
insert_documents([sel], Mongo::DB::SYSTEM_INDEX_COLLECTION, false, true)
rescue Mongo::OperationFailure
raise Mongo::OperationFailure, "Failed to create index #{sel.inspect}."
end
name name
end end