-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Mongoose 6.2.3 breaks behaviour used since 5.12.2 #11445
Comments
Probably occurs because of thisSo i guess as @hasezoey pointed out here (typegoose/typegoose#672 (comment)), there has been an update to useDb (ad01d5e). Why this breaks old behaviour i don't understand, and my current only solution is using dynamic imports. This is not feasible in all situations.. |
IS NOT A TYPEGOOSE ISSUE, tested with [email protected] and mongoose 6.2.1 and confirmed to work. Minimal reproduceable example: In MongoDB Connected
Master update: {
title: 'Master',
productID: 1,
_id: new ObjectId("62175c1a6139f021165f602e"),
__v: 0
}
Error [MongooseError]: Operation `products.insertOne()` buffering timed out after 10000ms
at Timeout.<anonymous> (C:\Users\User\Desktop\mongoose-error\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:151:23)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
Closing MongoDB connection master.. In MongoDB Connected
Master update: {
title: 'Master',
productID: 1,
_id: new ObjectId("62175804f97d81c206ce2ab3"),
__v: 0
}
MongoNotConnectedError: MongoClient must be connected to perform this operation
at getTopology (C:\Users\User\Desktop\mongoose-error\node_modules\mongodb\src\utils.ts:451:9)
at Db.createCollection (C:\Users\User\Desktop\mongoose-error\node_modules\mongodb\src\db.ts:261:18)
at NativeConnection.createCollection (C:\Users\User\Desktop\mongoose-error\node_modules\mongoose\lib\connection.js:404:11)
at NativeConnection.Connection.onOpen (C:\Users\User\Desktop\mongoose-error\node_modules\mongoose\lib\connection.js:635:10)
at NativeConnection.wireup (C:\Users\User\Desktop\mongoose-error\node_modules\mongoose\lib\drivers\node-mongodb-native\connection.js:105:13)
at Object.onceWrapper (events.js:519:28)
at NativeConnection.emit (events.js:400:28)
at NativeConnection.emit (domain.js:470:12)
at NativeConnection.set (C:\Users\User\Desktop\mongoose-error\node_modules\mongoose\lib\connection.js:126:12)
at NativeConnection.set (C:\Users\User\Desktop\mongoose-error\node_modules\mongoose\lib\connection.js:119:23) |
What file do I need to run? sync-data or worker? |
@IslandRhythms |
Fix will be in v6.2.7. We haven't been able to come up with a test case that reproduces this issue in our test suite, but I confirmed that 5bdd836 fixes the issue in your repo 👍 |
Thank you very much! @vkarpov15 |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
After updating to typegoose 9.7.0 and mongoose 6.2.3 (Works fine in 9.6.0 and 6.2.0) i get the error:
I have a master process that starts workers with the library https://threads.js.org/.
Before updating i had to create a new connection (DB class) In the child worker, such that i could use the typegoose model functions.
Code Example
DB (other DB connections here too, but truncated for example):
Master process:
Child worker
ProductModel
tsconfig.json
What is the expected behavior?
I expect it to not throw an error. Worked since typegoose 8.0.0-beta.2 and mongoose 5.12.2. Only with latest versions this breaks,
I suspect it has to do with the import "order" since:
After trial and error i can see that using dynamic import instead of
import { ProductModel } from '../../odm';
i don't get this error message, but this hasn't been a problem since start of project.Last version of typegoose + mongoose breaks this behaviour and i can't seem to find out why.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
The text was updated successfully, but these errors were encountered: