-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Remove Mongoose buffering layer #8702
Comments
I am not quite sure what Is that a native solution for buffering on the native mongodb driver? I liked the buffering behavior mainly because I didn't have to wait until the database is connected to initialize the rest of my code. |
Yes that is essentially the idea. With |
Thank you for the explanation, nice to see that behavior being achieved natively. |
We took a closer look at this and it looks like we're going to have to keep buffering, at least partially. The problem is that Mongoose buffering allows you to create models and execute commands before calling However, keeping this behavior isn't terrible, because the behavior we actually want to get rid of is buffering after initial connection. Mongoose buffering can kick in with cases where Mongoose thinks it is disconnected from the database, which is a problem for cases like #9262 where we may want to still allow queries when Mongoose thinks it is disconnected. This is also a problem because now Mongoose needs to maintain its own separate logic for when operations should be buffered, which may not line up exactly with how the MongoDB driver's server selection loop handles "buffering". TLDR; we're going to make a much more minor backwards breaking change that prevents Mongoose from buffering after initial connection, but we'll keep pre-connection buffering as is. |
Shouldn't be necessary if
useUnifiedTopology
is turned on by default. You can still doModel.find()
before callingmongoose.connect()
.Should fix issues:
#3698
#4979
The text was updated successfully, but these errors were encountered: