However, using the ruby driver, it seems that this command is not “committed” to the database, and the append actually never happens. The command I use in Ruby:
The issue you’re having is that by calling $db_handle[:first_collection].aggregate[ { "$merge" => { :into => "second_collection" } } ] the driver is only returning an instance of Mongo::Collection::View::Aggregation, not the results of the aggregation command.
Once you interact with this view instance the command will be executed and the $merge will produce results in the target collection.
The easiest way to do this is to call to_a on the view instance: