What is the current behaviour?
When importing mongoose you get the error.
(node:65821) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:65821) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:65821) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:65821) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
some trace errors
> (node:66064) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
at emitCircularRequireWarning (internal/modules/cjs/loader.js:814:11)
at Object.get (internal/modules/cjs/loader.js:825:5)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/db_ops.js:16:42)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/collection_ops.js:5:23)
(node:66064) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
at emitCircularRequireWarning (internal/modules/cjs/loader.js:814:11)
at Object.get (internal/modules/cjs/loader.js:825:5)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/db_ops.js:17:44)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/collection_ops.js:5:23)
(node:66064) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
at emitCircularRequireWarning (internal/modules/cjs/loader.js:814:11)
at Object.get (internal/modules/cjs/loader.js:825:5)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/db_ops.js:18:43)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/collection_ops.js:5:23)
(node:66064) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
at emitCircularRequireWarning (internal/modules/cjs/loader.js:814:11)
at Object.get (internal/modules/cjs/loader.js:825:5)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/db_ops.js:19:46)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/media/vorticalbox/Data/work/test/mongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/collection_ops.js:5:23)
If the current behavior is a bug, please provide the steps to reproduce.
import/require mongoose
Welcome to Node.js v14.0.0.
Type ".help" for more information.
> const m = require('mongoose');
What is the expected behavior?
no errors
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
node 14.0.0
mongoose 5.9.
I can confirm that running this on Node 14 triggers those warnings.
Exact same issue, it seems to work fine but just "spams" the console with it on startup
Nodejs 14.0.0 and mongoose 5.9.10
Apparently that's an issue with the native driver, I opened up an issue on jira, let's follow the progress there.
Will keep this issue open as a reference until mongodb v3.5.7.
Apparently, it has been fixed: https://github.com/mongodb/node-mongodb-native/commit/56a1b8aec3c4855b2709b27ff3127018cc2577aa
Related JIRA: https://jira.mongodb.org/browse/NODE-2536
I read about the driver issue on Jira but I still get this error, I don't have mongodb installed, connected via app url instead so Im only running mongoose with node 14. Do I need to update anything?
@malinhanak This is from the native mongodb driver, which is used by mongoose, not the database itself. There's a PR with upgrading mongodb which will fix the warning, should be fixed on [email protected]
Most helpful comment
Apparently, it has been fixed: https://github.com/mongodb/node-mongodb-native/commit/56a1b8aec3c4855b2709b27ff3127018cc2577aa
Related JIRA: https://jira.mongodb.org/browse/NODE-2536