lib/mongo/collection/view/aggregation.rb in mongo-2.18.0.beta1 vs lib/mongo/collection/view/aggregation.rb in mongo-2.18.0
- old
+ new
@@ -95,9 +95,12 @@
#
# @since 2.0.0
def initialize(view, pipeline, options = {})
@view = view
@pipeline = pipeline.dup
+ unless Mongo.broken_view_aggregate || view.filter.empty?
+ @pipeline.unshift(:$match => view.filter)
+ end
@options = BSON::Document.new(options).freeze
end
# Get the explain plan for the aggregation.
#