[SERVER-27976] explain command accepts unknown options Created: 10/Feb/17  Updated: 08/Sep/20  Resolved: 03/Jun/20

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

Type: Task Priority: Minor - P4
Reporter: David Storch Assignee: Mindaugas Malinauskas
Resolution: Done Votes: 0
Labels: neweng, pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Minor Change
Sprint: Query 2019-07-29, Query 2019-08-12, Query 2020-06-01, Query 2020-06-15
Participants:

 Description   

The explain command is willing to accept unrecognized arguments:

> db.c.drop()
true
> db.runCommand({explain: {find: "c"}, unknownArg: "unknown"})
{
	"queryPlanner" : {
           ...
	},
	"serverInfo" : {
            ...
	},
	"ok" : 1
}

We should consider changing it to reject unfamiliar arguments with a clear error message, returning ErrorCodes::InvalidOptions. One danger of this loose validation is that a future version of the server will introduce a new option. The fact that an older version is willing to ignore this new option, rather than failing on an option it does not understand, could complicate the upgrade procedure.



 Comments   
Comment by Mindaugas Malinauskas [ 04/Jun/20 ]

Author:

{'name': 'Mindaugas Malinauskas', 'email': 'mindaugas.malinauskas@mongodb.com'}

Message: SERVER-27976 explain command should not accept unknown options
Branch: master

https://github.com/mongodb/mongo/commit/e7fbef74d8b3a59aab2416be8e72fdac8640f088

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