[SERVER-28678] The explain command should reject explained commands containing readConcern or writeConcern Created: 07/Apr/17  Updated: 29/May/23

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

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to NODE-4184 AggregateOperation should not throw w... Backlog
is related to MONGOSH-1002 When executing explain on aggregate i... Waiting (Blocked)
is related to PHPLIB-802 Send readConcern but not writeConcern... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

Currently, the explain command ignores any readConcern or writeConcern fields contained in the explained commands:

MongoDB Enterprise > db.runCommand({ "explain" : { "find" : "test", "readConcern" : { "level" : "local" } } })
{
	"queryPlanner" : {
 
MongoDB Enterprise > db.runCommand({ "explain" : { "delete" : "test", deletes : [{q : {x : 1}, limit : 1}], "writeConcern" : { w : 1 } } })
{
	"queryPlanner" : {
...

Consider rejecting these commands, as read/write concern are not relevant to evaluating the query plan.

This would be a minor backwards breaking change for drivers, some of which currently would send an explain command with read/write concern fields present in the explained command.



 Comments   
Comment by Githook User [ 29/May/23 ]

Author:

{'name': 'Jérôme Tamarelle', 'email': 'jerome.tamarelle@mongodb.com', 'username': 'GromNaN'}

Message: PHPLIB-802: Send readConcern but not writeConcern to explain commands (#1080)

ReadConcern is relevant for query plan evaluation, not WriteConcern. The option is sent only for operations that support ReadConcern.
https://jira.mongodb.org/browse/SERVER-28678?focusedCommentId=3457279&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-3457279
Branch: master
https://github.com/mongodb/mongo-php-library/commit/118f08409fec7ce8be8664dc7bea0803842f8d2c

Comment by Asya Kamsky [ 21/Oct/20 ]

jeff.yemin that's not right:

> read/write concern are not relevant to evaluating the query plan

Read concern available (as opposed to local) does not use SHARDING_FILTER so the plan would be different.

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