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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.6.6, 2.8.0-rc1
    • Affects Version/s: 2.6.3, 2.6.4
    • Component/s: 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

      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.

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

              Created:
              Updated:
              Resolved: