     replaceParent: true
 
 if Meteor.isServer
-  # Initialize the database
+  # Initialize the database.
   MigrationTest.documents.remove {}
 
 testDefinition = (test, count) ->

  ,
    (test, expect) ->
      docs = MigrationTest.documents.find({renamed: 'another field'},
        transform: null, # So that we can use test.equal
        fields:
          _id: 0
      ).fetch()

      db = MongoInternals.defaultRemoteCollectionDriver().mongo.db
      test.isTrue db

      # Reset migrated count.
      Document.Migrations.update({}, {$set: {migrated: 0, all: 0}}, {multi: true})

      # We ignore any error.
      db.dropCollection 'OlderMigrationTests', Meteor.bindEnvironment expect(->), (e) -> throw e
      db.dropCollection 'OldMigrationTests', Meteor.bindEnvironment expect(->), (e) -> throw e
      db.dropCollection 'MigrationTests', Meteor.bindEnvironment expect(->), (e) -> throw e

      testDefinition test, 0

      # We should be able to call migrate multiple times.
      MigrationTest.migrateForward(MigrationTest.Meta.migrations[MigrationTest.Meta.migrations.length - 1])

      testDefinition test, 0

      # We ignore any error.
      db.dropCollection 'OlderMigrationTests', Meteor.bindEnvironment expect(->), (e) -> throw e
      db.dropCollection 'OldMigrationTests', Meteor.bindEnvironment expect(->), (e) -> throw e
      db.dropCollection 'MigrationTests', Meteor.bindEnvironment expect(->), (e) -> throw e
