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

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

    • Fully Compatible
    • v3.4
    • Query 2016-12-12, Query 2017-01-23

      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.

            Assignee:
            kyle.suarez@mongodb.com Kyle Suarez
            Reporter:
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: