Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33642

Alert client when parsing a query expression that will never be true

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query

      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.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: