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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.6.15, 4.0.7, 4.1.9, 3.4.24
    • Querying
    • None
    • Fully Compatible
    • ALL
    • v4.0, v3.6, v3.4, v3.2
    • Query 2019-01-28, Query 2019-02-11, Query 2019-02-25

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: