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

Oplog translates 'pushAll' to 'set'

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.4.3
    • Replication
    • None
    • OSX, Ubuntu
    • ALL
    • Hide

      1. chats.insert(

      {messages:[]}

      )
      2. chats.update(

      { _id: ObjectId("51a0249adae44c01b0000003") }

      , { '$pushAll': { messages: [

      {message: 'hey'}

      ] } }
      3. use local
      4. rs.oplog.find()

      Show
      1. chats.insert( {messages:[]} ) 2. chats.update( { _id: ObjectId("51a0249adae44c01b0000003") } , { '$pushAll': { messages: [ {message: 'hey'} ] } } 3. use local 4. rs.oplog.find()

    Description

      I'm watching the oplog for use within my application. I'm noticing some difference in behavior between 2.2.0 and 2.4.3. This is the query that's being run:

      chats.update(

      { _id: ObjectId("51a0249adae44c01b0000003") }

      ) { '$pushAll': { messages: [

      { _id: ObjectId("51a3dc72aead18550a000003"), timestamp: new Date("Mon, 27 May 2013 22:21:38 GMT"), username: 'Bob', message: 'hey' }

      ] } } {}

      It is generated by Mongoose as the result of pushing to a subdocument and calling model.save().

      In Mongo 2.2.0 this produces the following oplog entry:

      https://gist.github.com/bitmage/5659191

      While in Mongo 2.4.3 it produces this:

      https://gist.github.com/bitmage/5659209

      So it seems the 'pushAll' is being transformed into a 'set' which pushes out the contents of the entire Array.

      Can someone familiar with this change comment on the reason for it and if this will be changing back? Definitely doesn't seem good for my case... this would force my application to figure out the delta, and it also results in a lot of unnecessary data being sent around.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bitmage Brandon Mason
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: