@cocreate/crud-server
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "@cocreate/crud-server", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "CoCreate-crud-server", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "restricted" | ||
}, | ||
@@ -27,0 +27,0 @@ "scripts": { |
@@ -149,3 +149,3 @@ | ||
try { | ||
const collection = this.db.collection(req_data["collection"]); | ||
@@ -163,5 +163,13 @@ let objId = new ObjectID(); | ||
const update = {}; | ||
if( req_data['set'] ) update['$set'] = replaceArray(req_data['set']); | ||
if( req_data['unset'] ) update['$unset'] = req_data['unset'].reduce((r, d) => {r[d] = ""; return r}, {}); | ||
update['$set']['organization_id'] = req_data['organization_id']; | ||
let projection = {} | ||
Object.keys(update['$set']).forEach(x => { | ||
projection[x] = 1 | ||
}) | ||
collection.findOneAndUpdate( | ||
@@ -172,3 +180,4 @@ query, | ||
returnOriginal : false, | ||
upsert: req_data.upsert || false | ||
upsert: req_data.upsert || false, | ||
projection: projection, | ||
} | ||
@@ -175,0 +184,0 @@ ).then((result) => { |
97883
1505