-
Notifications
You must be signed in to change notification settings - Fork 4
Mongo 4 no roles check #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## mongo-driver-4-rc #94 +/- ##
=====================================================
- Coverage 87.08% 86.66% -0.42%
=====================================================
Files 8 8
Lines 813 810 -3
=====================================================
- Hits 708 702 -6
- Misses 105 108 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
56ce065 to
5b28284
Compare
| 'NotSupportedError', { | ||
| url: urls.sanitize(config.url), | ||
| version, | ||
| required: '>= 3.6.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't a different version being required by code changes elsewhere in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The driver only goes down to 3.6 now: https://www.mongodb.com/docs/drivers/node/current/compatibility/#mongodb-compatibility
So 3.6 is the hard limit on server version.
You can see the 2 checks are here:
Lines 152 to 180 in daa4ce3
| function _checkServerVersion({serverInfo, config}) { | |
| // check that server version is supported | |
| const {version} = serverInfo; | |
| logger.info('connected to database', { | |
| url: urls.sanitize(config.url), | |
| version, | |
| }); | |
| // if the server is not at least 3.6.0 throw | |
| // as mongo node driver 4 only supports 3.6.0 and higher | |
| if(!semver.gte(version, '3.6.0')) { | |
| throw new BedrockError( | |
| 'Unsupported database version.', | |
| 'NotSupportedError', { | |
| url: urls.sanitize(config.url), | |
| version, | |
| required: '>= 3.6.0' | |
| }); | |
| } | |
| if(config.requirements.serverVersion && | |
| !semver.satisfies(version, config.requirements.serverVersion)) { | |
| throw new BedrockError( | |
| 'Unsupported database version.', | |
| 'NotSupportedError', { | |
| url: urls.sanitize(config.url), | |
| version, | |
| required: config.requirements.serverVersion | |
| }); | |
| } | |
| } |
| config.mongodb.requirements = {}; | ||
| // server version requirement with server-style string | ||
| config.mongodb.requirements.serverVersion = '>=4.2'; | ||
| config.mongodb.requirements.serverVersion = '>=4.4'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 4.4 a requirement? We do still have some clusters on Atlas that are 4.2.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so 4.4 is the recommended min version, you can set the serverVersion as low as 3.6. See the compatibility matrix here: https://www.mongodb.com/docs/drivers/node/current/compatibility/#mongodb-compatibility
You can see the two checks here:
Lines 152 to 180 in daa4ce3
| function _checkServerVersion({serverInfo, config}) { | |
| // check that server version is supported | |
| const {version} = serverInfo; | |
| logger.info('connected to database', { | |
| url: urls.sanitize(config.url), | |
| version, | |
| }); | |
| // if the server is not at least 3.6.0 throw | |
| // as mongo node driver 4 only supports 3.6.0 and higher | |
| if(!semver.gte(version, '3.6.0')) { | |
| throw new BedrockError( | |
| 'Unsupported database version.', | |
| 'NotSupportedError', { | |
| url: urls.sanitize(config.url), | |
| version, | |
| required: '>= 3.6.0' | |
| }); | |
| } | |
| if(config.requirements.serverVersion && | |
| !semver.satisfies(version, config.requirements.serverVersion)) { | |
| throw new BedrockError( | |
| 'Unsupported database version.', | |
| 'NotSupportedError', { | |
| url: urls.sanitize(config.url), | |
| version, | |
| required: config.requirements.serverVersion | |
| }); | |
| } | |
| } |
|
Closing in favor of #107. |
./lib/authn.jsTODO:
Node Driver compatibility matrix is here: https://www.mongodb.com/docs/drivers/node/current/compatibility/#mongodb-compatibility
3.6 seems to be the lowest.