@sebasgoldberg/hardhat-mongodb
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

hardhat-mongodb

This plug-in it is used to add a mongodb db instance to the hardhat runtime environment.

Hardhat mongodb plugin.

What

This plugin will help you with the usage of a mongodb database in your hardhat's projects.

Installation

npm install @sebasgoldberg/hardhat-mongodb

Import the plugin in your hardhat.config.js:

require("@sebasgoldberg/hardhat-mongodb");

Or if you are using TypeScript, in your hardhat.config.ts:

import "@sebasgoldberg/hardhat-mongodb";

Environment extensions

This plugin extends the Hardhat Runtime Environment by adding a mongodb field.

Here is an example to get the mongodb db:

// ...
const db = await this.hre.mongodb.getDb()
// ...

Configuration

Here is the optional configuration of this plugin:

const config: HardhatUserConfig = {
    // ...
    mongodb: {
        dbConnectionString: 'mongodb://localhost:27017',
        dbName: 'hardhat'
    }
    // ...
}

The example above, shows the default configuration values.

Package Sidebar

Install

npm i @sebasgoldberg/hardhat-mongodb

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

14.3 kB

Total Files

18

Last publish

Collaborators

  • sebas.goldberg