-
-
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
insertMany return blank if all inserted docs is error (duplicated error) but not if one insertable item to return validation error #7822
Comments
What does your schema look like? Also, can you please post the custom validator that's reporting the 'SKU already exists' message? |
I though this was intended cause you said " but if ordered is not set (true by default) we should fall back to the current behavior." I think there is nothing wrong from my code except this behaviour is intended as this cause the link I ref to |
I'm still not sure I understand the issue here. I'm guessing you have an issue with |
The problem seem to arise when it hits the quick escape // We filter all failed pre-validations by removing nulls
const docAttributes = docs.filter(function(doc) {
return doc != null;
});
// Quickly escape while there aren't any valid docAttributes
if (docAttributes.length < 1) {
callback(null, []);
return;
} At this step all the information about the I recomment exiting with |
I'm going to close this issue and lock it, I haven't seen anything even remotely coherent in this thread. Please open up a separate issue with detailed code samples. |
When i insert docs with everything is duplicated items i got blank response
its really just give me this response [] (from console.log)
But when i give one something insertable. Its give me this response
PS: SKU is unique
Node.js: v12.2.0
"mongoose": "^5.5.9"
Mongodb: 4.0.9
The text was updated successfully, but these errors were encountered: