New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cocreate/mongodb

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/mongodb - npm Package Compare versions

Comparing version

to
1.4.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.4.0](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.3.2...v1.4.0) (2023-05-21)
### Features
* Refactor index.js document function to return updated documents when returnDocument is set to false. ([6dba55b](https://github.com/CoCreate-app/CoCreate-mongodb/commit/6dba55b93237d7e411ddacb09be7242f103edc7f))
## [1.3.2](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.3.1...v1.3.2) (2023-05-20)

@@ -2,0 +9,0 @@

2

package.json
{
"name": "@cocreate/mongodb",
"version": "1.3.2",
"version": "1.4.0",
"description": "A simple mongodb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -400,2 +400,16 @@ const { MongoClient, ObjectId } = require('mongodb');

doc._id = doc._id.toString()
if (data.returnDocument == false) {
let tempDoc = {};
let docs = new Map(data[type].map((obj) => [obj._id, obj]));
let doc1 = docs.get(doc._id)
if (doc1) {
tempDoc._id = tempDoc
for (let key of Object.keys(doc1)) {
tempDoc[key] = doc[key]
}
doc = tempDoc
}
}
documents.push(doc)

@@ -408,14 +422,2 @@ }

}
if (data.returnDocument == false) {
for (let item of data['data']) {
let resp = {};
resp['_id'] = tmp['_id']
data[type].forEach((f) => resp[f] = item[f])
documents.push(resp);
}
data['data'] = documents
}
}

@@ -422,0 +424,0 @@