[DOCS-13210] Investigate changes in SERVER-44056: regression in {$meta: "textScore"} projection Created: 07/Nov/19  Updated: 13/Nov/23  Resolved: 21/Feb/20

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.3.1, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Jeffrey Allen
Resolution: Gone away Votes: 0
Labels: docs-grab-bag
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-44056 regression in {$meta: "textScore"} pr... Closed
Participants:
Days since reply: 3 years, 50 weeks, 5 days ago
Epic Link: DOCS: 4.4 Server Release Work

 Description   

Description

Downstream Change Summary

In 4.2, a find() command with a textScore $meta projection, e.g.
db.c.find({}, {a: {$meta: "textScore"}})

would assign a value of 0 to 'a' if no textScore metadata was available.

The default value in 4.3/master is missing (that is, 'a' will not be present in the returned document).

Feel free to slack me if you have questions.

Description of Linked Ticket

A Java driver functional test of  {$meta: "textScore"} projection recently regressed when running against latest mongod. The regression occurred somewhere between the commit hashes 560b542 and c119ef4.

Test setup:

> db.test.insert({x: 1, y: [{a: 1, b: 2}, {a: 2, b: 3}, {a: 3, b: 4}]})
> db.test.createIndex({y: "text"})

Expected results contain a synthetic score field:

> db.test.find({}, {score: {"$meta": "textScore"}})
{ "_id" : ObjectId("5da7cc88458e2388ffaedd5f"), 
  "x" : 1, 
  "y" : [ { "a" : 1, "b" : 2 }, { "a" : 2, "b" : 3 }, { "a" : 3, "b" : 4 } ], 
  "score" : 0 
}

Results after the regression omit the score field:

MongoDB Enterprise > db.test.find({}, {score: {"$meta": "textScore"}})
{ "_id" : ObjectId("5da7ce30522390ed46b8b869"), 
   "x" : 1, 
   "y" : [ { "a" : 1, "b" : 2 }, { "a" : 2, "b" : 3 }, { "a" : 3, "b" : 4 } ] 
}

Educated guess is that the fix for SERVER-42423 is the culprit.

Scope of changes

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)



 Comments   
Comment by Jeffrey Allen [ 21/Feb/20 ]

Behavior changed in SERVER-43816. The docs ticket for the new behavior is DOCS-13305

Comment by Jeffrey Allen [ 21/Feb/20 ]

Thanks david.storch, I'll close this one.

Comment by David Storch [ 21/Feb/20 ]

jeffrey.allen, ah, yeah that sounds right. You're correct that the behavior introduced for this example in SERVER-44056 was subsequently changed by SERVER-43816 and this query will now fail:

MongoDB Enterprise > db.test.createIndex({y: "text"})
MongoDB Enterprise > db.test.find({}, {score: {"$meta": "textScore"}})
Error: error: {
	"ok" : 0,
	"errmsg" : "query requires text score metadata, but it is not available",
	"code" : 40218,
	"codeName" : "Location40218"
}

Therefore, it probably makes sense to close this ticket as superseded by DOCS-13305.

Generated at Thu Feb 08 08:07:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.