Skip to content

Commit

Permalink
perf(schema): correctly pull DocumentArrayPath default _id value wh…
Browse files Browse the repository at this point in the history
…en creating document array with schema re: #11541
  • Loading branch information
vkarpov15 committed Jun 26, 2022
1 parent 9e05baf commit 3a1c821
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/schema/documentarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ let Subdocument;
*/

function DocumentArrayPath(key, schema, options, schemaOptions) {
const schemaTypeIdOption = DocumentArrayPath.defaultOptions &&
DocumentArrayPath.defaultOptions._id;
if (schemaTypeIdOption != null) {
schemaOptions = schemaOptions || {};
schemaOptions._id = schemaTypeIdOption;
}

if (schemaOptions != null && schemaOptions._id != null) {
schema = handleIdOption(schema, schemaOptions);
} else if (options != null && options._id != null) {
Expand Down

0 comments on commit 3a1c821

Please sign in to comment.