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

numeric mod prevents application of positional mod on same field, without uassert

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.2
    • None
    • Write Ops
    • None
    • ALL

    Description

      If an explicit array field mod and a positional mod reference the same field, the numeric mod currently wins out. Generally when (non positional) mods may conflict we uassert instead of allowing one to trump the other. We might consider adopting a policy that is similar to that.

      Test:

      c = db.c;
      c.drop();
       
      c.save( { a:[ 1 ] } );
      // The 'a.0' update wins out here:
      c.update( { a:1 }, { $set:{ 'a.0':2, 'a.$':3 } } );
      printjson( c.find().toArray() );

      Attachments

        Activity

          People

            Unassigned Unassigned
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: