Dynamically choose MongoDB API

Use Connection if using an older mongopy, otherwise use MongoClient.