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

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.6.0-rc0
    • Fix Version/s: 3.1.5
    • Component/s: Querying
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      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

              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: