You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my app I'm switched from default connection to "manual" connections:
// main db file which creates several connectionsconstdb1=mongoose.createConnection(uri,opts);// in model fileconstUser=db1.model('User',UserSchema);User.find(...);
But in one file I forgot to change default mongoose connection on "manual" connection:
// main db file// does not setup default connection any more // mongoose.connect(uri, opts);// in model fileconstArticle=mongoose.model('Article',ArticleSchema);
And when try to make some request on Article, my app hang express requests (freeze them in pending status). How I understood it waiting when default connection will be initialized for proceeding operation. But connection will never be initialized.
@vkarpov15 it will be cool if you somehow add checking if a connection is not initialized and user performs some query operation on model with such dumb connection. I suppose operation (find, count, update ...) should throw an error (cb(err) or reject if promise).
PS. This case very hard to diagnose if using bunch of logic wrappers on top of mongoose. In my case express - react-relay-network-layer:batchExpressMiddleware - graphql-express - graphql-compose - graphql-compose-mongoose - mongoose.
PSS. For me, it's no error anymore, but further users may be blocked by this buggy silence.
The text was updated successfully, but these errors were encountered:
sobafuchs
added
enhancement
This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
new feature
This change adds new functionality, like a new method or class
and removed
enhancement
This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
labels
Feb 14, 2017
Yeah this is something we're planning on changing in 5.0. Buffering was really meant to minimize the number of callbacks necessary but that's much less of a problem now than it was in 2012. Not something we can really change right now without being backwards breaking though.
I think we can close this one now that we have bufferTimeoutMS, which means that you'll at least get some error message after 10 seconds by default if you're using a model that is tied to a connection that you never called connect() on.
In my app I'm switched from default connection to "manual" connections:
But in one file I forgot to change default mongoose connection on "manual" connection:
And when try to make some request on Article, my app hang express requests (freeze them in pending status). How I understood it waiting when default connection will be initialized for proceeding operation. But connection will never be initialized.
@vkarpov15 it will be cool if you somehow add checking if a connection is not initialized and user performs some query operation on model with such dumb connection. I suppose operation (find, count, update ...) should throw an error (cb(err) or reject if promise).
PS. This case very hard to diagnose if using bunch of logic wrappers on top of mongoose. In my case
express
-react-relay-network-layer:batchExpressMiddleware
-graphql-express
-graphql-compose
-graphql-compose-mongoose
-mongoose
.PSS. For me, it's no error anymore, but further users may be blocked by this buggy silence.
The text was updated successfully, but these errors were encountered: