-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix circular reference between modules db.js and db_ops.js #1828
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
'use strict'; | ||
|
||
const dbConstants = require("./db_constants"); | ||
const EventEmitter = require('events').EventEmitter; | ||
const inherits = require('util').inherits; | ||
const getSingleProperty = require('./utils').getSingleProperty; | ||
|
@@ -532,7 +533,7 @@ Db.prototype.listCollections = function(filter, options) { | |
// Return options | ||
const _options = { transforms: listCollectionsTransforms(this.s.databaseName) }; | ||
// Get the cursor | ||
cursor = this.collection(Db.SYSTEM_NAMESPACE_COLLECTION).find(filter, _options); | ||
cursor = this.collection(dbConstants.SYSTEM_NAMESPACE_COLLECTION).find(filter, _options); | ||
// Do we have a readPreference, apply it | ||
if (options.readPreference) cursor.setReadPreference(options.readPreference); | ||
// Set the passed in batch size if one was provided | ||
|
@@ -973,12 +974,4 @@ Db.prototype.getLogger = function() { | |
* @type {Db} | ||
*/ | ||
|
||
// Constants | ||
Db.SYSTEM_NAMESPACE_COLLECTION = 'system.namespaces'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a breaking change |
||
Db.SYSTEM_INDEX_COLLECTION = 'system.indexes'; | ||
Db.SYSTEM_PROFILE_COLLECTION = 'system.profile'; | ||
Db.SYSTEM_USER_COLLECTION = 'system.users'; | ||
Db.SYSTEM_COMMAND_COLLECTION = '$cmd'; | ||
Db.SYSTEM_JS_COLLECTION = 'system.js'; | ||
|
||
module.exports = Db; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we rename this file just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we can rename this file. |
||
|
||
// Constants | ||
module.exports.SYSTEM_NAMESPACE_COLLECTION = 'system.namespaces'; | ||
module.exports.SYSTEM_INDEX_COLLECTION = 'system.indexes'; | ||
module.exports.SYSTEM_PROFILE_COLLECTION = 'system.profile'; | ||
module.exports.SYSTEM_USER_COLLECTION = 'system.users'; | ||
module.exports.SYSTEM_COMMAND_COLLECTION = '$cmd'; | ||
module.exports.SYSTEM_JS_COLLECTION = 'system.js'; |
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.
By removing this, it would technically break our public API, since these values were previously exposed publicly. Can we add the following code to ensure they are still exposed?
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.
Yes, interesting approach.