mongoose 8.13.0 → 8.13.1

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.
@@ -78,7 +78,12 @@ function assignRawDocsToIdStructure(rawIds, resultDocs, resultOrder, options, re
78
78
  continue;
79
79
  }
80
80
 
81
- sid = String(id);
81
+ if (id?.constructor?.name === 'Binary' && id.sub_type === 4 && typeof id.toUUID === 'function') {
82
+ // Workaround for gh-15315 because Mongoose UUIDs don't use BSON UUIDs yet.
83
+ sid = String(id.toUUID());
84
+ } else {
85
+ sid = String(id);
86
+ }
82
87
  doc = resultDocs[sid];
83
88
  // If user wants separate copies of same doc, use this option
84
89
  if (options.clone && doc != null) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mongoose",
3
3
  "description": "Mongoose MongoDB ODM",
4
- "version": "8.13.0",
4
+ "version": "8.13.1",
5
5
  "author": "Guillermo Rauch <guillermo@learnboost.com>",
6
6
  "keywords": [
7
7
  "mongodb",
@@ -97,7 +97,7 @@ declare module 'mongoose' {
97
97
  * The default value for this path. If a function, Mongoose executes the function
98
98
  * and uses the return value as the default.
99
99
  */
100
- default?: DefaultType<T> | ((this: EnforcedDocType, doc: any) => DefaultType<T>) | null;
100
+ default?: DefaultType<T> | ((this: EnforcedDocType, doc: any) => DefaultType<T> | null | undefined) | null;
101
101
 
102
102
  /**
103
103
  * The model that `populate()` should use if populating this path.