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

Encoding of projection for query plan cache should be type-insensitive

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.5
    • Affects Version/s: 2.6.0-rc0
    • Component/s: Querying
    • Fully Compatible
    • ALL
    • Quint Iteration 5

      Queries with projection {a:1.0} should not be considered of a different shape than queries with projection {a:NumberInt(1)}. This can be particularly confusing to users of the plan cache shell helpers, who will see shapes seemingly listed twice when in fact they differ in the BSON type of the projection (as the shell renders them identically).

      > db.foo.getPlanCache().clear()
      > db.foo.find({a:1,b:1},{a:1})
      > db.foo.getPlanCache().listQueryShapes()
      [
      	{
      		"query" : {
      			"a" : 1,
      			"b" : 1
      		},
      		"sort" : {
      
      		},
      		"projection" : {
      			"a" : 1
      		}
      	}
      ]
      > db.foo.find({a:1,b:1},{a:NumberInt(1)})
      > db.foo.getPlanCache().listQueryShapes()
      [
      	{ // first query
      		"query" : {
      			"a" : 1,
      			"b" : 1
      		},
      		"sort" : {
      
      		},
      		"projection" : {
      			"a" : 1
      		}
      	},
      	{ // second query, but looks the same
      		"query" : {
      			"a" : 1,
      			"b" : 1
      		},
      		"sort" : {
      
      		},
      		"projection" : {
      			"a" : 1
      		}
      	}
      ]
      >
      

        1. filterfailure.js
          2 kB
          Charlie Page

            Assignee:
            qingyang.chen Qingyang Chen
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: