Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

transactions-mongoose

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

transactions-mongoose - npm Package Compare versions

Comparing version 1.1.9 to 1.1.10

examples/create-insert.js

5

package.json
{
"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"

26

README.md

@@ -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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc