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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.15, 4.0.7, 4.1.9, 3.4.24
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.0, v3.6, v3.4, v3.2
    • Sprint:
      Query 2019-01-28, Query 2019-02-11, Query 2019-02-25
    • Case:

      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

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

                Dates

                Created:
                Updated:
                Resolved: