2.0.0 • Published 6 years ago

egg-mongo v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

egg-mongo

Database mongo plug-in for egg provide mongo database access functions

Install

$ npm i egg-mongo --save

Configuration

Change ${app_root}/config/plugin.js to enable MongoDB plugin:

exports.mongo = {
  enable: true,
  package: 'egg-mongo',
};

Configure database information in ${app_root}/config/config.default.js:

Simple database instance

//  app/config/config.default.js
mongo: {
  url: 'mongodb://localhost:27017',
  dbname: 'dbName'
}

// app/controller/home.js class HomeController extends Controller { async index() { const testCollection = this.app.mongo.db.collection('testCollection'); collectionNames = await testCollection.find({}).toArray(); this.ctx.body = collectionNames; } }

2.0.0

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.0.0

7 years ago

0.0.1

7 years ago