Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-3366

Explain Plan not using Collation

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.18.0
    • Affects Version/s: None
    • Component/s: Compass
    • None
    • Environment:
      macOS 10.14.2
      mongodb 4.0.4
    • Iteration Vol au Vent

      It would seem that the Explain Plan is not taking the Collation arguments into account when performing the query. When doing explain() on a shell, it shows me using the index, Compass does not (see attached image).

      db.users.find({username:'mark.garrett@allcarepharmacy.com', isActive: true}).collation({locale:'en', strength: 2}).explain()
      {
      	"queryPlanner" : {
      		"plannerVersion" : 1,
      		"namespace" : "spp.users",
      		"indexFilterSet" : false,
      		"parsedQuery" : {
      			"$and" : [
      				{
      					"isActive" : {
      						"$eq" : true
      					}
      				},
      				{
      					"username" : {
      						"$eq" : "mark.garrett@allcarepharmacy.com"
      					}
      				}
      			]
      		},
      		"collation" : {
      			"locale" : "en",
      			"caseLevel" : false,
      			"caseFirst" : "off",
      			"strength" : 2,
      			"numericOrdering" : false,
      			"alternate" : "non-ignorable",
      			"maxVariable" : "punct",
      			"normalization" : false,
      			"backwards" : false,
      			"version" : "57.1"
      		},
      		"winningPlan" : {
      			"stage" : "FETCH",
      			"inputStage" : {
      				"stage" : "IXSCAN",
      				"keyPattern" : {
      					"username" : 1,
      					"isActive" : 1
      				},
      				"indexName" : "username_1_isActive_1",
      				"collation" : {
      					"locale" : "en",
      					"caseLevel" : false,
      					"caseFirst" : "off",
      					"strength" : 2,
      					"numericOrdering" : false,
      					"alternate" : "non-ignorable",
      					"maxVariable" : "punct",
      					"normalization" : false,
      					"backwards" : false,
      					"version" : "57.1"
      				},
      				"isMultiKey" : false,
      				"multiKeyPaths" : {
      					"username" : [ ],
      					"isActive" : [ ]
      				},
      				"isUnique" : true,
      				"isSparse" : false,
      				"isPartial" : false,
      				"indexVersion" : 2,
      				"direction" : "forward",
      				"indexBounds" : {
      					"username" : [
      						"[\"A)K=\b5)KK1OO\nz)??-)K1G7)KA)-Y\b-EA\u0001$\", \"A)K=\b5)KK1OO\nz)??-)K1G7)KA)-Y\b-EA\u0001$\"]"
      					],
      					"isActive" : [
      						"[true, true]"
      					]
      				}
      			}
      		},
      		"rejectedPlans" : [ ]
      	},
      	"serverInfo" : {
      		"host" : "xxxxxxxxxxxxxxxx",
      		"port" : 27017,
      		"version" : "4.0.4-1",
      		"gitVersion" : "8664823baee70273f47949a8cde68bde37c69930"
      	},
      	"ok" : 1
      }
      

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            moderndeveloperllc Mark Garrett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: