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

Updates against paths composed with array index notation and positional operator fail with error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 2.6.3, 2.6.4
    • 2.6.6, 2.8.0-rc1
    • Write Ops
    • None
    • ALL
    • Hide

      I get that error on these queries:

      db.music.update({ 'rounds.0.groups.0.teams.crawlerTeamId': '69',
        id: 'iranLeagueEvents-1393' }, {$set: { 'rounds.0.groups.0.teams.$.standing': 
         { crawlerTeamId: '70'} });

      or this one StackOverFlow

      db.music.update({genre : "Grunge", "bands.0.albums.0.tracks.order" : 1}, {$set:{"bands.0.albums.0.tracks.$.name":"Smells Like Teen Spirit!"}})

      Show
      I get that error on these queries: db.music.update({ 'rounds.0.groups.0.teams.crawlerTeamId' : '69' , id: 'iranLeagueEvents-1393' }, {$set: { 'rounds.0.groups.0.teams.$.standing' : { crawlerTeamId: '70' } }); or this one StackOverFlow db.music.update({genre : "Grunge" , "bands.0.albums.0.tracks.order" : 1}, {$set:{ "bands.0.albums.0.tracks.$.name" : "Smells Like Teen Spirit!" }})
    • Query 2.7.8

    Description

      I'm using "$" positional per update in a project, It was working without any problem in Ubuntu (mongoDB 2.4), I cloned the project into Archlinux and i get this error on db.collection.update:

      { [MongoError: The positional operator did not find the match needed from the query. Unexpanded update: rounds.0.groups.0.teams.$.standing]
        name: 'MongoError',
        code: 16837,
        err: 'The positional operator did not find the match needed from the query. Unexpanded update: rounds.0.groups.0.teams.$.standing' }

      while I'm sure that the find query always match only one object in mongoDB.
      Seems the last version of mongoDB broke backward compatibility of this functionality.

      Attachments

        Issue Links

          Activity

            People

              rassi J Rassi
              bersam Bersam Karbasion
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: