anlek/mongify — pull request #9 by Pranas (2012-09-09 18:51:28+00:00)
Title: Fix translation process when embedding multiple objects

I've encountered an issue when embedding multiple objects.

The problem is embedded object is added by ``$addToSet`` but old objects are also saved with parent by ``$set`` operation. Like this:

````
"$addToSet" => { "comments" => { "body" => "new comment" } }, "$set" => { "comments" => [{"body" => "previous comment"}]}
````

This causes ``$set`` to override ``$addToSet`` operation and you end up with only the first object you embedded.

I've added tests that covers this issue.