[SERVER-33642] Alert client when parsing a query expression that will never be true Created: 02/Mar/18  Updated: 06/Dec/22  Resolved: 16/Mar/18

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

Type: Improvement Priority: Major - P3
Reporter: Kelsey Schubert Assignee: Backlog - Query Team (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-33925 Queries that are known to return no r... Backlog
is related to SERVER-33506 COLLSCAN when using lookup with parti... Closed
Assigned Teams:
Query
Participants:

 Description   

Currently, if a user accidentally issues a query with an expression stage that can never be true, we complete a COLLSCAN that produces no results.

> db.foo.find({$expr:{$eq:["a","b"]}}).explain()
{
	"queryPlanner" : {
		"plannerVersion" : 1,
		"namespace" : "test.foo",
		"indexFilterSet" : false,
		"parsedQuery" : {
			"$expr" : {
				"$const" : false
			}
		},
		"winningPlan" : {
			"stage" : "COLLSCAN",
			"filter" : {
				"$expr" : {
					"$const" : false
				}
			},
			"direction" : "forward"
		},
		"rejectedPlans" : [ ]
	},
	"serverInfo" : {
		"host" : "grey.local",
		"port" : 27017,
		"version" : "3.6.3",
		"gitVersion" : "9586e557d54ef70f9ca4b43c26892cd55257e1a5"
	},
	"ok" : 1
}

It would be preferable to error to alert the user that the query was malformed.



 Comments   
Comment by Ian Whalen (Inactive) [ 16/Mar/18 ]

Such queries are valid queries that succeed and we want to avoid adding logging on the success path, so we're closing this as superseded by SERVER-33925.

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