diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index b5b98a5..7cd0b36 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -624,7 +624,12 @@ module Mongo if raw result elsif result["result"] - @db[result["result"]] + if result['result'].is_a? BSON::OrderedHash and result['result'].has_key? 'db' and result['result'].has_key? 'collection' + otherdb = @db.connection[result['result']['db']] + otherdb[result['result']['collection']] + else + @db[result["result"]] + end else raise ArgumentError, "Could not instantiate collection from result. If you specified " + "{:out => {:inline => true}}, then you must also specify :raw => true to get the results."