koa-mongo-transaction

1.0.8 • Public • Published

koa-mongo-transaction

koa middleware to provide declarative transaction for mongodb.

Example

For koa:

var Koa = require('koa');
var koaMongoTransaction = require('koa-mongo-transaction');
 
var app = new Koa();
app.use(koaMongoTransaction());
 
app.use(async ctx => {
  await dbOp();
});

options

patchMongo

Whether monkey patch the mongodb package so that you don't have to specify session option for every command. Defaults to true.

mongoClient

MongoClient instance to use. If not set, an attempt to require('mongoose') to retrieve MongoClient instance will be made.

/koa-mongo-transaction/

    Package Sidebar

    Install

    npm i koa-mongo-transaction

    Weekly Downloads

    0

    Version

    1.0.8

    License

    MIT

    Unpacked Size

    5.66 kB

    Total Files

    5

    Last publish

    Collaborators

    • mr_jin