Forbid queries with a $meta project and a non-$meta sort on same field

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 2.5.5
    • Affects Version/s: 2.5.4
    • Component/s: Querying, Text Search
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Forbid queries such as:

      db.collection.find({$text:{$search:"hello"}},{s:{$meta:"textScore"}}).sort({s:-1})
      
      • This will help users figure out more quickly that they have to use sort({s:{$meta:"textScore"}}), not sort({s:-1}).
      • There is no support currently for these queries on a sharded collection (current behavior: mongod will sort on the value of the field in the document, but mongos will merge sort on the projected score field).
      • The analogous aggregation pipeline will in fact work as intended – by design, it can "correctly" sort on the computed field "s". Forbidding these queries in the query engine will avoid defining conflicting behavior for the two query systems.

            Assignee:
            J Rassi (Inactive)
            Reporter:
            J Rassi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: