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

Consider improving error message when attempting $natural sort on a view

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Backport Completed:
    • Backport Requested:
      v3.4
    • Sprint:
      Query 2016-12-12, Query 2017-01-23

      Description

      It's currently not possible to use $natural in aggregation to force a "natural sort order". However, if a user attempts a $natural sort when running the find command on a view, they'll get this fairly unnatural-looking error message:

      > db.view.find().sort( { $natural: 1 } )
      Error: error: {
              "ok" : 0,
              "errmsg" : "FieldPath field names may not start with '$'.",
              "code" : 16410,
              "codeName" : "Location16410"
      }
      

      We should consider whether or not to detect this up-front in order to produce a clearer error message for the user.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: