Mongo::Collection#aggregate was doing a strict arg.class == Array and arg.class == Hash. I changed this to use is_a? to make it easier to pass arguments like HashWithIndifferentAccess, which shouldn't interfere with the functionality.
A simple test is included.
Loosen type check for Mongo::Collection#aggregate
@kamarcum thanks for the contribution, but it looks like this broke a few tests in a few different versions of Ruby. Aside from the failures in Travis, make sure you've also validated your change with rake test:replica_set in 1.8.7, 1.9.3 and JRuby.
Those two failures on Travis are pretty mysterious to me. Any hints?
I had only run rake test, and only with 1.9.3. I'll see if I can reproduce any of that locally.
Fix failure in 1.8.7
Well. I'm glad in a way that commit didn't make a difference in Travis. I couldn't think of a reason 1.8.7 would treat this code differently, so I guessed.
Looks like a few of those initial failures were not related to your change and just Travis weirdness (specifically JRuby). However, it's definitely still failing for for Ruby 1.8.x. I'd love to merge this change, and I think it's a great contribution but making it work for 1.8.x is a must before I can do so.
Let me know when you've had a chance to look at this build failure: