function dbTest(name, run) {
  test(name, async (t) => {
    t.beforeEach(async (ctx) => {
      ctx.nr = {}
      ctx.nr.agent = helper.instrumentMockedAgent()

      const mongodb = require('mongodb')
      ctx.nr.mongodb = mongodb

      await collectionCommon.dropTestCollections(mongodb)
      MONGO_HOST = common.getHostName(ctx.nr.agent)
      MONGO_PORT = common.getPort()

      const res = await common.connect({ mongodb })
      ctx.nr.client = res.client
      ctx.nr.db = res.db
    })

    t.afterEach(async (ctx) => {
      await common.close(ctx.nr.client, ctx.nr.db)
      helper.unloadAgent(ctx.nr.agent)
      removeModules(['mongodb'])
    })

    await t.test('without transaction', (t, end) => {
      const { agent, db } = t.nr
      run(db, function () {
        assert.equal(agent.getTransaction(), undefined, 'should not have transaction')
        end()
      })
    })

    await t.test('with transaction', (t, end) => {
      const { agent, db } = t.nr
      assert.equal(agent.getTransaction(), undefined, 'should not have transaction')
      helper.runInTransaction(agent, function (transaction) {
        run(db, function (names, opts = {}) {
          verifyMongoSegments(agent, transaction, names, opts)
          transaction.end()
          end()
        })
      })
    })
  })
}
Very similar to the test runner in `./collection-common.js`. Refer to the
docblocks there for clarification.

@param {string} name Parent test name.
@param {function} run Provided a db instance and a verify callback.