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

Add $collStats aggregate pipeline stage to API version 1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 4.9.0
    • None
    • 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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: