@cocreate/mongodb
Advanced tools
Comparing version 1.16.0 to 1.16.1
@@ -0,1 +1,8 @@ | ||
## [1.16.1](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.16.0...v1.16.1) (2024-01-08) | ||
### Bug Fixes | ||
* handling of array item update ([a189784](https://github.com/CoCreate-app/CoCreate-mongodb/commit/a1897845606460defe3d3d628e73b18d3abf6f32)) | ||
# [1.16.0](https://github.com/CoCreate-app/CoCreate-mongodb/compare/v1.15.0...v1.16.0) (2024-01-08) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@cocreate/mongodb", | ||
"version": "1.16.0", | ||
"version": "1.16.1", | ||
"description": "A simple mongodb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -584,8 +584,16 @@ const { MongoClient, ObjectId } = require('mongodb'); | ||
if (typeof index === 'number' && index >= 0) { | ||
if (operator === '$push') | ||
updates[key] = [data[originalKey]] | ||
if (!operator) | ||
operator = "$set" | ||
else { | ||
if (operator === '$push') | ||
updates[key] = [data[originalKey]] | ||
let insert = { $each: updates[key] } | ||
insert.$postion = index | ||
updates[key] = insert | ||
let insert = { $each: updates[key] } | ||
insert.$postion = index | ||
if (index >= 0) | ||
updates[arrayKey] = insert | ||
else | ||
updates[key] = insert | ||
} | ||
} | ||
@@ -592,0 +600,0 @@ } else if (operator === '$inc') { |
128026
758