Support :db key for :out in map_reduce
References RUBY-389
This commit is contained in:
parent
4858d3030b
commit
28796ac7de
|
@ -624,7 +624,12 @@ module Mongo
|
||||||
if raw
|
if raw
|
||||||
result
|
result
|
||||||
elsif result["result"]
|
elsif 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"]]
|
@db[result["result"]]
|
||||||
|
end
|
||||||
else
|
else
|
||||||
raise ArgumentError, "Could not instantiate collection from result. If you specified " +
|
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."
|
"{:out => {:inline => true}}, then you must also specify :raw => true to get the results."
|
||||||
|
|
Loading…
Reference in New Issue