Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
2.1.0
-
None
Description
In documentation http://docs.mongodb.org/ecosystem/tutorial/ruby-driver-tutorial/#aggregation it states that the correct way to add the "allowDiskUse" option to the aggregation is:
aggregation.allow_disk_use(true)
aggregation.each do |document|
#=> Yields a BSON::Document.
end
and then continues on iterating the results from "aggregation".
However when tested against 2.1.0 the above command does not modify aggregation in place, but instead returns a new aggregation object with that option specified. To make it work we need to do:
aggregation = aggregation.allow_disk_use(true)
aggregation.each do |document|
#=> Yields a BSON::Document.
end
or
aggregation.allow_disk_use(true).each do |document|
#=> Yields a BSON::Document.
end
Not sure which one of the two solutions was intended but it would be nice to have either the documentation or the driver fix to comply with the other.