Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
2.5.4
-
None
Description
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.