Skip to content

Commit

Permalink
chore(service-deps): upgrade mongodb client (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
LironEr authored Jan 12, 2024
1 parent beb23c3 commit eed6989
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.3'

services:
mongo:
image: mongo:5
image: mongo:7.0
ports:
- '51651:27017'
volumes:
Expand Down
2 changes: 1 addition & 1 deletion service/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.3'

services:
mongo:
image: mongo:5
image: mongo:7.0
ports:
- '51652:27017'
logging:
Expand Down
2 changes: 1 addition & 1 deletion service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"bytes": "^3.1.2",
"env-var": "^7.3.1",
"fastify": "^4.21.0",
"mongodb": "^5.7.0"
"mongodb": "^6.3.0"
},
"devDependencies": {
"@types/bytes": "^3.1.1",
Expand Down
8 changes: 3 additions & 5 deletions service/src/framework/mongo/commitRecords/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const createCommitRecord = async (projectId: string, payload: CommitRecor
const commitRecordsCollection = await getCommitRecordsCollection();
const recordToSave = commitRecordPayloadToDBModel(projectId, payload);

const result = await commitRecordsCollection.findOneAndReplace(
const newRecord = await commitRecordsCollection.findOneAndReplace(
{ projectId, subProject: payload.subProject, commitSha: payload.commitSha },
recordToSave,
{
Expand All @@ -22,8 +22,6 @@ export const createCommitRecord = async (projectId: string, payload: CommitRecor
}
);

const newRecord = result.value;

if (!newRecord) {
throw new Error('Failed to findOneAndReplace record');
}
Expand Down Expand Up @@ -227,11 +225,11 @@ export async function addReviewToCommitRecord(
{ returnDocument: ReturnDocument.AFTER }
);

if (!result.value) {
if (!result) {
throw new Error('Failed to update reviews list');
}

return commitRecordDBToResponse(result.value);
return commitRecordDBToResponse(result);
}

function transformReviewToDB(review: CommitRecordReview | undefined): CommitRecordReviewDB | undefined {
Expand Down
8 changes: 4 additions & 4 deletions service/src/framework/mongo/projects.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectId } from 'mongodb';
import { ObjectId, ReturnDocument } from 'mongodb';
import { getCollection } from './client';

import type { ProjectApiKey, GitDetails } from '../../types';
Expand Down Expand Up @@ -53,11 +53,11 @@ export const getOrCreateProjectId = async (details: GitDetails): Promise<string>
$setOnInsert: { creationDate: new Date() },
$set: { lastAccessed: new Date() },
},
{ upsert: true, returnDocument: 'after' }
{ upsert: true, returnDocument: ReturnDocument.AFTER }
);

if (result.ok === 1 && result.value) {
return result.value._id.toHexString();
if (result) {
return result._id.toHexString();
}

throw new Error('failed to get or update project');
Expand Down
72 changes: 37 additions & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4336,12 +4336,11 @@
resolved "https://registry.yarnpkg.com/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz#e33bc8ea812a01f63f90481c666334844b12a09e"
integrity sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==

"@types/whatwg-url@^8.2.1":
version "8.2.1"
resolved "https://registry.yarnpkg.com/@types/whatwg-url/-/whatwg-url-8.2.1.tgz#f1aac222dab7c59e011663a0cb0a3117b2ef05d4"
integrity sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==
"@types/whatwg-url@^11.0.2":
version "11.0.4"
resolved "https://registry.yarnpkg.com/@types/whatwg-url/-/whatwg-url-11.0.4.tgz#ffed0dc8d89d91f62e3f368fcbda222a487c4f63"
integrity sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==
dependencies:
"@types/node" "*"
"@types/webidl-conversions" "*"

"@types/ws@^8.5.5":
Expand Down Expand Up @@ -5852,10 +5851,10 @@ bser@2.1.1:
dependencies:
node-int64 "^0.4.0"

bson@^5.4.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/bson/-/bson-5.4.0.tgz#0eea77276d490953ad8616b483298dbff07384c6"
integrity sha512-WRZ5SQI5GfUuKnPTNmAYPiKIof3ORXAF4IRU5UcgmivNIon01rWQlw5RUH954dpu8yGL8T59YShVddIPaU/gFA==
bson@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/bson/-/bson-6.2.0.tgz#4b6acafc266ba18eeee111373c2699304a9ba0a3"
integrity sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==

btoa-lite@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -12268,24 +12267,22 @@ moize@^6.1.0, moize@^6.1.3:
fast-equals "^3.0.1"
micro-memoize "^4.1.2"

mongodb-connection-string-url@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz#57901bf352372abdde812c81be47b75c6b2ec5cf"
integrity sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==
mongodb-connection-string-url@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz#b4f87f92fd8593f3b9365f592515a06d304a1e9c"
integrity sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==
dependencies:
"@types/whatwg-url" "^8.2.1"
whatwg-url "^11.0.0"
"@types/whatwg-url" "^11.0.2"
whatwg-url "^13.0.0"

mongodb@^5.7.0:
version "5.8.0"
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-5.8.0.tgz#d45bbbb06170086bbfa3a932dbb42c92fc25270f"
integrity sha512-xx4CXmxcj3bNe7iGBlhntVrUqrNARYhUZteXaz4epEESv4oXD/FONAovcyoCaEffdYlw25Yz284OxMfpnPLlgQ==
mongodb@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-6.3.0.tgz#ec9993b19f7ed2ea715b903fcac6171c9d1d38ca"
integrity sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==
dependencies:
bson "^5.4.0"
mongodb-connection-string-url "^2.6.0"
socks "^2.7.1"
optionalDependencies:
"@mongodb-js/saslprep" "^1.1.0"
bson "^6.2.0"
mongodb-connection-string-url "^3.0.0"

move-file@^3.0.0:
version "3.1.0"
Expand Down Expand Up @@ -13992,11 +13989,16 @@ pump@^1.0.0:
end-of-stream "^1.1.0"
once "^1.3.1"

punycode@^2.1.0, punycode@^2.1.1:
punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

punycode@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==

pupa@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/pupa/-/pupa-3.1.0.tgz#f15610274376bbcc70c9a3aa8b505ea23f41c579"
Expand Down Expand Up @@ -15160,7 +15162,7 @@ socks-proxy-agent@^7.0.0:
debug "^4.3.3"
socks "^2.6.2"

socks@^2.6.2, socks@^2.7.1:
socks@^2.6.2:
version "2.7.1"
resolved "https://registry.yarnpkg.com/socks/-/socks-2.7.1.tgz#d8e651247178fde79c0663043e07240196857d55"
integrity sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==
Expand Down Expand Up @@ -16029,12 +16031,12 @@ touch@^3.1.0:
dependencies:
nopt "~1.0.10"

tr46@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9"
integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==
tr46@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-4.1.1.tgz#281a758dcc82aeb4fe38c7dfe4d11a395aac8469"
integrity sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==
dependencies:
punycode "^2.1.1"
punycode "^2.3.0"

tr46@~0.0.3:
version "0.0.3"
Expand Down Expand Up @@ -16848,12 +16850,12 @@ well-known-symbols@^2.0.0:
resolved "https://registry.yarnpkg.com/well-known-symbols/-/well-known-symbols-2.0.0.tgz#e9c7c07dbd132b7b84212c8174391ec1f9871ba5"
integrity sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==

whatwg-url@^11.0.0:
version "11.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018"
integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==
whatwg-url@^13.0.0:
version "13.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-13.0.0.tgz#b7b536aca48306394a34e44bda8e99f332410f8f"
integrity sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==
dependencies:
tr46 "^3.0.0"
tr46 "^4.1.1"
webidl-conversions "^7.0.0"

whatwg-url@^5.0.0:
Expand Down

0 comments on commit eed6989

Please sign in to comment.