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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.5.2
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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() );
      

            Assignee:
            Unassigned
            Reporter:
            Aaron Staple (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: