Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-9744

$sample can only use a random cursor if it is the first stage in the pipeline.

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: Server
    • Labels:
      None

      The $sample stage docs mention that if N is less than 5% of the collection the $sample stage can be optimized to use a random cursor. This is only true if the $sample stage comes first in the pipeline, and that should be noted.

            Assignee:
            steve.renaker@mongodb.com Steve Renaker (Inactive)
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              7 years, 16 weeks, 5 days ago