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

$elemMatch $ne serialization is incorrect, doesn't roundtrip

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.15, 4.0.7, 4.1.9, 3.4.24
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v4.0, v3.6, v3.4, v3.2
    • Query 2019-01-28, Query 2019-02-11, Query 2019-02-25

      To reproduce: 

      ./mongo

      > pipeline = [\{ $match: { 'a': { $elemMatch: {$ne:400 }} }} ]

      > db.hello.explain().aggregate(pipeline)

      Result looks like: 

       {
      	"stages" : [
      		{
      			"$cursor" : {
      				"query" : {
      					"a" : {
      						"$elemMatch" : {
      							"$ne" : 400
      						}
      					}
      				},
      				"queryPlanner" : {
      					"plannerVersion" : 1,
      					"namespace" : "test.hello",
      					"indexFilterSet" : false,
      					"parsedQuery" : {
      						"a" : {
      							"$elemMatch" : {
      								"0" : {
      									"" : {
      										"$eq" : 400
      									}
      								}
      							}
      						}
      					},
      					"winningPlan" : {
      						"stage" : "EOF"
      					},
      					"rejectedPlans" : [ ]
      				}
      			}
      		}
      	],
      	"ok" : 1
      }

       

       Note that parsedQuery does not make sense. Namely, it has a key value which is an empty string.

            Assignee:
            james.wahlin@mongodb.com James Wahlin
            Reporter:
            brigitte.lamarche@mongodb.com Brigitte Lamarche (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: