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

Add $collStats aggregate pipeline stage to API version 1

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide

      Set API strict on a 4.9+ server.

      Run an aggregate with the $collStats stage.

      Show
      Set API strict on a 4.9+ server. Run an aggregate with the $collStats stage.
    • Query Optimization 2021-03-08, Query Optimization 2021-03-22
    • 157

      During the spec writing of DRIVERS-1437 in SPEC-1780, where we were changing estimatedDocumentCount to use $collStats instead of count, we expected that doing so would allow estimatedDocumentCount to be used with a strict API. However, we found that the $collStats stage is not a part of versioned API, as shown in this error "expected no error, but got (APIStrictError) stage $collStats is not allowed with 'apiStrict: true' in API Version 1".

      If the $collStats stage in not included in API version 1, drivers will have to deprecate the estimatedDocumentCount function altogether, which is not ideal nor is it the apparent goal of the scope for removing count from API version 1.

      It seems as though $collStats was initially intended to be part of API version 1 but was not added for some reason.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: