Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5395

Call aggregate directly on collection instead of on find view

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 8.0.1
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible

      Mongoid has one place in master where it calls `collection.find.aggregate`.:

      lib/mongoid/contextual/aggregable/mongo.rb:          result = collection.find.aggregate(pipeline(field), session: _session).to_a
      

      This usage can cause issues if https://jira.mongodb.org/browse/RUBY-2797 is implemented to pass find view parameters to the aggregation pipeline.

      Mongoid should simply invoke aggregate directly on the collection, as is documented in https://www.mongodb.com/docs/ruby-driver/master/reference/aggregation/.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: