Switch migrations to use Repository as appropriate

In order for the _updated_at field to be correctly applied the
migrations that operate on buckets need to be using the Repository class
to modify the data in mongodb.

The Repository find() method had to be modified to be able to use both
classes that provide a to_mongo_query() method (the Query class) or a
Dictionary as would be usual with a mongodb find.

I have added some tests to make sure that Repository will work correctly
when accepting both types of find() argument.