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

$near does not specify the sort order

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      A student in M102 asks "The video indicates that $near sorts automatically by descending distance. My interpretation of descending would be that the location the greatest distance away is listed first and the closest location is listed last which seems counter-intuitive. The documentation is non-specific for the sort order of $near. Can you please clarify this?"

      And sure enough, we do not specify what "sorted by distance" means. Descending? Ascending? Can it be changed with -1?

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            epc Ed Costello
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11 years, 6 weeks, 1 day ago