[SERVER-12038] Forbid $meta sort on field that does not have $meta project Created: 11/Dec/13  Updated: 11/Jul/16  Resolved: 21/Jan/14

Status: Closed
Project: Core Server
Component/s: Text Search
Affects Version/s: 2.5.4
Fix Version/s: 2.5.5

Type: Bug Priority: Minor - P4
Reporter: Tyler Brock Assignee: J Rassi
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

In the spec it says:

Examples of sorts disallowed by the grammar:
{“x.y”: {$meta: “text”}}

Examples invalid queries with a $meta sort (where a corresponding $meta projection is not correctly specified):
db.collection.find({$text: {$search: “hello”}, {t: {$meta: “text”}}).sort({s: {$meta: “text”}})

Yet this appears to work (and sort using the text metadata):

> db.test.find(
    { $text: {$search: "tyler" }},
    {s: {$meta: "text"}}).sort({"WRONG.\^$.$$$": {$meta: "text"}}
)
{ "words" : "tyler brock", "cool" : true, "s" : 0.75 }
{ "words" : "tyler brock awesome cool", "s" : 0.625 }
{ "words" : "tyler brock cool cool", "s" : 0.625 }



 Comments   
Comment by Githook User [ 21/Jan/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-12038 Add required $meta proj to CanonicalQueryTest test case
Branch: master
https://github.com/mongodb/mongo/commit/df45324b26d66f8a5155a0a9799b0ba000544ebb

Comment by Githook User [ 21/Jan/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-12038 SERVER-12193 LiteParsedQuery validate queries with $meta

Comment by Githook User [ 21/Jan/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-12038 PipelineD::prepareCursorSource resilient to CQ failure

Query clients should check return value of canonicalize (since e.g.
queries with $meta sort but no $meta projection should fail to
canonicalize).
Branch: master
https://github.com/mongodb/mongo/commit/400f00648f2ade62031d6dc2efe0cf7f51de9010

Comment by Githook User [ 14/Jan/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: Revert "SERVER-12038 SERVER-12193 LiteParsedQuery validate queries with $meta"

This reverts commit 192f4bcd1b9a91cad4f184ad7cd3679b56cb9f5f.
Branch: master
https://github.com/mongodb/mongo/commit/9154de8aea7424d0b26b92d1b09d0164caee7c66

Comment by Githook User [ 13/Jan/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-12038 SERVER-12193 PlanCacheTest should use $meta properly

It is no longer valid to use a $meta sort without a $meta projection.
Update PlanCacheTest suite accordingly.
Branch: master
https://github.com/mongodb/mongo/commit/4f9c0008b9c046690d9d84579ccd98b8553412ab

Comment by Githook User [ 13/Jan/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-12038 SERVER-12193 LiteParsedQuery validate queries with $meta

Generated at Thu Feb 08 03:27:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.