Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d3m3vilurr/mongoose-transaction
it's a dirty mongoose transaction
https://github.com/d3m3vilurr/mongoose-transaction
Last synced: 20 days ago
JSON representation
it's a dirty mongoose transaction
- Host: GitHub
- URL: https://github.com/d3m3vilurr/mongoose-transaction
- Owner: d3m3vilurr
- License: mit
- Created: 2017-06-09T09:19:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-10T05:02:52.000Z (about 5 years ago)
- Last Synced: 2024-12-10T14:49:34.831Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 196 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# mongoose-transaction
This project provide transaction feature between multiple connection/collection mongodb.## Install
``` bash
npm install mongoose-transaction
```## How to use
``` javascript
var mongoose = require('mongoose');
var transaction = require('mongoose-transaction');var conn = mongoose.connect('mongodb://localhost:27017', function(err) {
var TestSchema = new mongoose.Schema({
data: Number,
});
var Transaction = connection.model(transaction.TRANSACTION_COLLECTION, transaction.TransactionSchema);
var TestModel = transaction.TransactedModel(conn, 'Test', TestSchema);Transaction.begin(function(err, t) {
var doc = new TestModel({data: 10});
t.add(doc);
t.commit(function(err) {
});
});
});
```