Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

A node module for transaction-like db writes

Notifications You must be signed in to change notification settings

zauberlabs/mongoose-transaction

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongoose-transaction

A node module for transaction-like db writes

Build Status NPM Version NPM Downloads

mongoose-transaction handles insert, update and remove.

If any operation that you provide to mongoose-transaction fails, all the documents that involved in the process will return back to its old state.

Example:

var mongoose = require('mongoose');
var Transaction = require('mongoose-transaction')(mongoose);
  
var transaction = new Transaction();
transaction.insert('User', {userId:'someuser1' , emailId:'test email1'});
transaction.update('User', id, {userId:'someuser2' , emailId:'test email2'});
transaction.remove('User', id2);
transaction.run(function(err, docs){
  // your code here
});

To run the tests:

npm test

About

A node module for transaction-like db writes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%