-
-
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
Model.bulkWrite() hangs forever when run on an empty list and ordered: false #13664
Comments
The reproduction link doesn't work for me, by the way (gives 404). |
Fixed now. (I accidentally made the repo private) |
const mongoose = require('mongoose');
const testSchema = new mongoose.Schema({
name: String
});
const Test = mongoose.model('Test', testSchema);
async function run() {
await mongoose.connect('mongodb://localhost:27017');
await mongoose.connection.dropDatabase();
await Test.bulkWrite([], {ordered: false});
console.log('done');
}
run(); |
fix(model): avoid hanging on empty `bulkWrite()` with ordered: false
@vkarpov15 would you be willing to backport this fix onto Mongoose 6 as well? It would be very much appreciated! |
@vkarpov15 thanks. 6.11.6 no longer hangs forever, but it makes |
fix(model): make Model.bulkWrite() with empty array and ordered false not throw an error
Prerequisites
Mongoose version
7.4.1
Node.js version
18.14.0
MongoDB server version
6.0.5
Typescript version (if applicable)
No response
Description
Running
Model.bulkWrite([], {ordered: false})
hangs forever. This is broken on 7.4.1 and 6.11.4. It works correctly on 6.8.4.Scanning the changelog, I suspect the issue is #13218, but I did not look too closely.
Steps to Reproduce
https://github.com/JavaScriptBach/test-mongoose-bulkwrite/tree/main
Expected Behavior
The call completes and returns.
The text was updated successfully, but these errors were encountered: