[SERVER-12343] meta projections can project into illegal fields Created: 13/Jan/14  Updated: 10/Dec/14  Resolved: 13/Jan/14

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Andrew Emil (Inactive) Assignee: Unassigned
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   

Currently one can use the meta projections to put fill fields that would normally be invalid. Though they are valid json results, we probably should avoid letting users create documents using mongo, that they cannot then save in mongo.

> db.test.ensureIndex({a:"text"})
> db.test.insert({a: "test text"})
SingleWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 1,
        "nUpserted" : 0,
        "nUpdated" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})
> db.test.find({$text: {$search: "text"}}, {$query: {$meta: "textScore"}})
{ "_id" : ObjectId("52d4351004b77493319064a3"), "a" : "test text", "$query" : 0.75 }



 Comments   
Comment by Scott Hernandez (Inactive) [ 13/Jan/14 ]

I don't see this as a problem since we only exclude those field names for storage in the database, not returned results nor bson.

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