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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.6.0-rc0
    • 3.1.5
    • Querying
    • Fully Compatible
    • ALL
    • Quint Iteration 5

    Description

      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
      		}
      	}
      ]
      >
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: