From f0f8a9f5bd981c4049d34b05ef181c3d084e0704 Mon Sep 17 00:00:00 2001 From: Allan Chau Date: Fri, 16 Feb 2024 13:44:21 +0930 Subject: [PATCH] fix configs error --- linz.js | 15 ++++++++------- package.json | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/linz.js b/linz.js index 36b270ef..029b14c3 100644 --- a/linz.js +++ b/linz.js @@ -405,15 +405,16 @@ Linz.prototype.initConfigs = function(cb) { ); }); - // overwrite _id field with custom id name - newConfig['_id'] = configName; - // Use update instead of insert to prevent duplicate key errors. try { - await collection.updateOne(newConfig, { - upsert: true, - w: 1, - }); + await collection.updateOne( + { _id: configName }, + { $set: newConfig }, + { + upsert: true, + w: 1, + } + ); debugConfigs('Initialised config %s', configName); diff --git a/package.json b/package.json index eafa6d4f..3e975eba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "linz", - "version": "1.0.0-19.0.0-beta.9", + "version": "1.0.0-19.0.0-beta.10", "description": "Node.js web application framework", "license": "MIT", "main": "linz.js",