From 0b4b3385f218c4085d8d9f641a28a6e567f4c918 Mon Sep 17 00:00:00 2001 From: vanpho93 Date: Tue, 3 Jan 2023 16:53:54 +0700 Subject: [PATCH] feat: upgrade mongodb to 5.0 Signed-off-by: vanpho93 --- .changeset/smart-balloons-draw.md | 5 +++++ docker-compose.circleci.yml | 2 +- docker-compose.dev.yml | 2 +- docker-compose.yml | 4 ++-- packages/api-core/src/ReactionAPICore.js | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 .changeset/smart-balloons-draw.md diff --git a/.changeset/smart-balloons-draw.md b/.changeset/smart-balloons-draw.md new file mode 100644 index 00000000000..aa41b3c6feb --- /dev/null +++ b/.changeset/smart-balloons-draw.md @@ -0,0 +1,5 @@ +--- +"@reactioncommerce/api-core": minor +--- + +feat: upgrade mongodb to verion 5.0 diff --git a/docker-compose.circleci.yml b/docker-compose.circleci.yml index a0a4047edbe..b8873e57e5e 100644 --- a/docker-compose.circleci.yml +++ b/docker-compose.circleci.yml @@ -25,7 +25,7 @@ services: - "3000:3000" mongo: - image: mongo:4.2.0 + image: mongo:5.0 command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger networks: - default diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 3144014eb73..6724cc5b71a 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -2,7 +2,7 @@ version: "3.4" services: mongo: - image: mongo:4.2.0 + image: mongo:5.0 command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger networks: default: diff --git a/docker-compose.yml b/docker-compose.yml index 6b8b761aca3..130481fbb55 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ networks: services: api: - image: reactioncommerce/reaction:4.2.0 + image: reactioncommerce/reaction:4.2.7 depends_on: - mongo env_file: @@ -25,7 +25,7 @@ services: - "3000:3000" mongo: - image: mongo:4.2.0 + image: mongo:5.0 command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger networks: - default diff --git a/packages/api-core/src/ReactionAPICore.js b/packages/api-core/src/ReactionAPICore.js index 395645d2424..082f13792a8 100644 --- a/packages/api-core/src/ReactionAPICore.js +++ b/packages/api-core/src/ReactionAPICore.js @@ -348,8 +348,9 @@ export default class ReactionAPICore { const prevInsertOne = collection.insertOne.bind(collection); collection.insertOne = (async (...args) => { const response = await prevInsertOne(...args); + const insertedCount = response.acknowledged ? 1 : 0; // eslint-disable-next-line id-length - return { ...response, result: { n: response.acknowledged ? 1 : 0, ok: acknowledgedToOk(response.acknowledged) } }; + return { ...response, insertedCount, result: { n: insertedCount, ok: acknowledgedToOk(response.acknowledged) } }; }).bind(collection); const prevFindOneAndUpdate = collection.findOneAndUpdate.bind(collection);