Skip to content

Commit

Permalink
fix some merge conflicts with 6.x from #12791
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 21, 2023
1 parent 28260a7 commit 835017d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/document.js
Expand Up @@ -2793,7 +2793,7 @@ Document.prototype.$__validate = function(pathsToValidate, options, callback) {

// only validate required fields when necessary
const pathDetails = _getPathsToValidate(this, pathsToValidate, pathsToSkip);
let paths = shouldValidateModifiedOnly ?
const paths = shouldValidateModifiedOnly ?
pathDetails[0].filter((path) => this.$isModified(path)) :
pathDetails[0];
const skipSchemaValidators = pathDetails[1];
Expand Down Expand Up @@ -2993,7 +2993,7 @@ Document.prototype.validateSync = function(pathsToValidate, options) {

// only validate required fields when necessary
const pathDetails = _getPathsToValidate(this, pathsToValidate, pathsToSkip);
let paths = shouldValidateModifiedOnly ?
const paths = shouldValidateModifiedOnly ?
pathDetails[0].filter((path) => this.$isModified(path)) :
pathDetails[0];
const skipSchemaValidators = pathDetails[1];
Expand Down
9 changes: 8 additions & 1 deletion lib/model.js
Expand Up @@ -3108,10 +3108,17 @@ Model.$__insertMany = function(arr, options, callback) {

if (rawResult) {
if (ordered === false) {
for (let i = 0; i < results.length; ++i) {
if (results[i] === void 0) {
results[i] = docs[i];
}
}

// Decorate with mongoose validation errors in case of unordered,
// because then still do `insertMany()`
res.mongoose = {
validationErrors: validationErrors
validationErrors: validationErrors,
results: results
};
}
return callback(null, res);
Expand Down

0 comments on commit 835017d

Please sign in to comment.