transactions-mongoose
Advanced tools
Comparing version 1.1.9 to 1.1.10
{ | ||
"name": "transactions-mongoose", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "Transactions for mongoose", | ||
@@ -26,2 +26,5 @@ "main": "index.js", | ||
}, | ||
"devDependencies": { | ||
"mongodb-memory-server": "^8.16.0" | ||
}, | ||
"scripts": { | ||
@@ -28,0 +31,0 @@ "test": "echo \"Error: no test specified\" && exit 0" |
@@ -32,3 +32,3 @@ # 🇺🇦 Transactions for mongoose | ||
```javascript | ||
const Transaction = require("transactions-mongoose"); | ||
const {Transaction} = require("transactions-mongoose"); | ||
const transaction = new Transaction(); | ||
@@ -41,5 +41,5 @@ // or with debug log | ||
### Create / Insert new document | ||
### [Create / Insert new document](https://github.com/rosbitskyy/transactions-mongoose/blob/main/examples/create-insert.js) | ||
```javascript | ||
const Transaction = require("transactions-mongoose"); | ||
const {Transaction} = require("transactions-mongoose"); | ||
const transaction = new Transaction().setSendbox(true); | ||
@@ -58,3 +58,3 @@ | ||
age: 21, | ||
sex: 'famale', | ||
sex: 'female', | ||
status: 'free' | ||
@@ -71,9 +71,9 @@ }); | ||
console.log('transaction 1', transactionData1.result) // the result of the save() operation | ||
console.log('transaction 1 result', transactionData1.result) // the result of the save() operation | ||
console.log('transaction 2 document', transactionData2.document) | ||
``` | ||
### Update an existing one | ||
### [Update an existing one](https://github.com/rosbitskyy/transactions-mongoose/blob/main/examples/update-existing.js) | ||
```javascript | ||
const Transaction = require("transactions-mongoose"); | ||
const {Transaction} = require("transactions-mongoose"); | ||
const transaction = new Transaction().setSendbox(true); | ||
@@ -105,6 +105,6 @@ | ||
### Executing an isolated block that may fail is not related to Mongo but affects whether the data is saved or not. | ||
### [Executing an isolated block that may fail is not related to Mongo but affects whether the data is saved or not.](https://github.com/rosbitskyy/transactions-mongoose/blob/main/examples/execute.js) | ||
```javascript | ||
const fetch = require("node-fetch"); | ||
const Transaction = require("transactions-mongoose"); | ||
const {Transaction} = require("transactions-mongoose"); | ||
const transaction = new Transaction().setSendbox(true); | ||
@@ -146,3 +146,3 @@ | ||
// https://mongoosejs.com/docs/api/query.html#Query.prototype.updateOne() | ||
return td.result | ||
return td | ||
}); | ||
@@ -155,9 +155,9 @@ | ||
await transaction.commit(); | ||
console.log('transaction result', transactionData.result); | ||
console.log('transaction result', transactionData.result.result); | ||
``` | ||
### With session executor | ||
### [With session executor](https://github.com/rosbitskyy/transactions-mongoose/blob/main/examples/sessions.js) | ||
```javascript | ||
const Transaction = require("transactions-mongoose"); | ||
const {Transaction} = require("transactions-mongoose"); | ||
const transaction = new Transaction().setSendbox(true); | ||
@@ -164,0 +164,0 @@ |
@@ -300,3 +300,7 @@ /* | ||
id, ...(name && {document: name}), | ||
model: model || funcType, checkAsyncValidators, checkValidateSchema, checkValidateUniques, modifiedData, | ||
model: (model || {}).modelName || funcType, | ||
checkAsyncValidators, | ||
checkValidateSchema, | ||
checkValidateUniques, | ||
modifiedData, | ||
} | ||
@@ -303,0 +307,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55672
13
915
1
1