mongotransaction

1.1.1 • Public • Published

MongoTransactions

A library providing utility methods to easily implement transactions in mongoDB. It provides some well know methods of Oracle Transactions like Savepoints, Rollbacks, Commits and some wrappers over the CUD(Excluding Read) operations.

Installation

npm install mongotransactions --save

Usage

General Methods

var Transactions = require('mongotransactions')
Transactions();			\\ Enable transactions
Begin(callback);		\\ Beginning a tarnsaction
Savepoint(callback)		\\ Make Savepoint ... Savepoints are certain markers where we can return to during our tarnsactions
Rollback(callback)		\\ Rollback to a Savepoint undoing all the CUD operations done untill now
Commit(callback)		\\ Commit all the changes to the database. These changes cannot be rolled backed as they have been updated on the database.
End(callback)			\\ End the Transaction 

Wrapper Wrappers defined for insert, delete, update, findoneandupdate. The general syntax is <wrapper_method>(modelInstance,query{not for insert},data{not for remove},callback);

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style.

Release History

  • 1.0.0 Initial release

Package Sidebar

Install

npm i mongotransaction

Weekly Downloads

0

Version

1.1.1

License

ISC

Last publish

Collaborators

  • archop