mongoose 8.16.2 → 8.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/document.js CHANGED
@@ -1517,6 +1517,8 @@ Document.prototype.$set = function $set(path, val, type, options) {
1517
1517
 
1518
1518
  if (schema.$isSingleNested && (this.isDirectModified(path) || val == null)) {
1519
1519
  cleanModifiedSubpaths(this, path);
1520
+ } else if (schema.$isSchemaMap && val == null) {
1521
+ cleanModifiedSubpaths(this, path);
1520
1522
  }
1521
1523
 
1522
1524
  return this;
@@ -62,6 +62,7 @@ function SchemaDocumentArray(key, schema, options, schemaOptions) {
62
62
  SchemaArray.call(this, key, EmbeddedDocument, options);
63
63
 
64
64
  this.schema = schema;
65
+ // EmbeddedDocument schematype options
65
66
  this.schemaOptions = schemaOptions || {};
66
67
  this.$isMongooseDocumentArray = true;
67
68
  this.Constructor = EmbeddedDocument;
@@ -83,9 +84,7 @@ function SchemaDocumentArray(key, schema, options, schemaOptions) {
83
84
 
84
85
  const $parentSchemaType = this;
85
86
  this.$embeddedSchemaType = new DocumentArrayElement(key + '.$', {
86
- required: this &&
87
- this.schemaOptions &&
88
- this.schemaOptions.required || false,
87
+ ...(schemaOptions || {}),
89
88
  $parentSchemaType
90
89
  });
91
90
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mongoose",
3
3
  "description": "Mongoose MongoDB ODM",
4
- "version": "8.16.2",
4
+ "version": "8.16.3",
5
5
  "author": "Guillermo Rauch <guillermo@learnboost.com>",
6
6
  "keywords": [
7
7
  "mongodb",
package/types/query.d.ts CHANGED
@@ -758,7 +758,7 @@ declare module 'mongoose' {
758
758
 
759
759
  /** Specifies which document fields to include or exclude (also known as the query "projection") */
760
760
  select<RawDocTypeOverride extends { [P in keyof RawDocType]?: any } = {}>(
761
- arg: string | string[] | Record<string, number | boolean | string | object>
761
+ arg: string | readonly string[] | Record<string, number | boolean | string | object>
762
762
  ): QueryWithHelpers<
763
763
  IfEquals<
764
764
  RawDocTypeOverride,