Skip to content

Commit

Permalink
Fix Small Bug with _id in update function
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuyk committed Jul 12, 2023
1 parent cc17f4e commit 4a11053
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 121 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.0.5

- Fix small bug with `_id` in update function

# 1.0.4

- Added deleteDocument function
Expand Down
119 changes: 0 additions & 119 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stuyk/cross-resource-cache",
"version": "1.0.4",
"version": "1.0.5",
"description": "add mongodb database saving to cross resource environments for altv",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/database/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export async function update<T extends { [key: string]: any }>(data: T, collecti
try {
const result = await client
.collection(collection)
.findOneAndUpdate({ _id: new ObjectId(data._id) }, { $set: data });
.findOneAndUpdate({ _id: new ObjectId(data._id) }, { $set: dataClone });
return result.ok ? true : false;
} catch (err) {
return false;
Expand Down

0 comments on commit 4a11053

Please sign in to comment.