Skip to content

fix(db): move db constants to other file to avoid circular ref - #1858

Merged
daprahamian merged 2 commits into
masterfrom
NODE-1692/db-constants
Oct 29, 2018
Merged

fix(db): move db constants to other file to avoid circular ref#1858
daprahamian merged 2 commits into
masterfrom
NODE-1692/db-constants

Conversation

@daprahamian

Copy link
Copy Markdown
Contributor

lib/db.js referenced lib/operations/db_ops.js, which in turn
referenced lib/db.js to get some constants. Moved constants to
their own file, and used dynamic imports to get DB constructor

Fixes NODE-1692

Replaces #1828

lib/db.js referenced lib/operations/db_ops.js, which in turn
referenced lib/db.js to get some constants. Moved constants to
their own file, and used dynamic imports to get DB constructor

Fixes NODE-1692

@kvwalker kvwalker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mbroadst mbroadst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one request then :shipit:

Comment thread lib/db_constants.js
@@ -0,0 +1,10 @@
'use strict';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to the other PR, can we just rename this file constants.js, in the likely event we will end up with non-db related constants. Trying to contain file bloat here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that we shouldindividually bring the constants on to the Db constructor instead of using Object.assign? If we add new constants, it will be easy to accidentally expose them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think that is probably best practice

@daprahamian
daprahamian merged commit 239036f into master Oct 29, 2018
@daprahamian
daprahamian deleted the NODE-1692/db-constants branch October 29, 2018 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants