Skip to content

Commit

Permalink
fix configs error
Browse files Browse the repository at this point in the history
  • Loading branch information
allanchau committed Feb 16, 2024
1 parent c415dbb commit f0f8a9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions linz.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit f0f8a9f

Please sign in to comment.