mongoid/mongoid — pull request #3199 by vicentemundim (2013-08-01 22:30:10+00:00)
Title: Splitting $pushAll and $pull conflicting operations into multiple update...

...s

When pushing or pulling values of embedded documents in different levels on a document in a single update mongoid complains with a "have conflicting mods in update" error. This change splits the conflicting operations into multiple ones, thus avoiding the error.

For example, before this change when you had two pulls like this:

```ruby
{ "addresses.0.locations" => { "_id" => { "$in" => [ "two" ]}} } # $pull
{ "addresses" => { "_id" => { "$in" => [ "one" ]}} } # $pull
```

Mongoid would generate a single update, and MongoDB would complain with a "have conflicting mods in update" error.

Also if you had a set and two conflicting pushes like this:

```ruby
{ "addresses.0.street" => "Bond" } # $set
{ "addresses.0.locations" => { "street" => "Bond St" } } # $pushAll
{ "addresses" => { "street" => "Oxford St" } } # $pushAll
```

It would also generate an update with the $set and other with two $pushAll, and this second update would fail.

The change makes any conflict like this to generate an update.