Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-78874

countCommandAsAggregationCommand() should return an AggregationRequest, not a BSONObj

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • Fully Compatible

      Since a view is defined by an aggregation pipeline, we convert any count, distinct, or find command request to an equivalent aggregation command.

      For the count command, this is accomplished with countCommandAsAggregationCommand. Currently this returns a BSONObj, which we almost always parse immediately into an AggregationRequest. For performance and simplicity, we should change these methods to return a StatusWith<AggregationRequest> directly.

      Also, if the caller always uses uassertStatusOK on the result, we can further simplify by returning AggregationRequest directly, and throwing an exception in the error case.

            Assignee:
            ruchitha.rajaghatta@mongodb.com Ruchitha Rajaghatta
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: