mongoose 8.9.6 → 8.9.7

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
@@ -4069,7 +4069,7 @@ Document.prototype.$__toObjectShallow = function $__toObjectShallow() {
4069
4069
  * @param {Boolean} [options.flattenMaps=false] if true, convert Maps to POJOs. Useful if you want to `JSON.stringify()` the result of `toObject()`.
4070
4070
  * @param {Boolean} [options.flattenObjectIds=false] if true, convert any ObjectIds in the result to 24 character hex strings.
4071
4071
  * @param {Boolean} [options.useProjection=false] - If true, omits fields that are excluded in this document's projection. Unless you specified a projection, this will omit any field that has `select: false` in the schema.
4072
- * @return {Object} js object (not a POJO)
4072
+ * @return {Object} document as a plain old JavaScript object (POJO). This object may contain ObjectIds, Maps, Dates, mongodb.Binary, Buffers, and other non-POJO values.
4073
4073
  * @see mongodb.Binary https://mongodb.github.io/node-mongodb-native/4.9/classes/Binary.html
4074
4074
  * @api public
4075
4075
  * @memberOf Document
@@ -19,6 +19,9 @@ module.exports = function applyDefaults(doc, fields, exclude, hasIncludedChildre
19
19
  const type = doc.$__schema.paths[p];
20
20
  const path = type.splitPath();
21
21
  const len = path.length;
22
+ if (path[len - 1] === '$*') {
23
+ continue;
24
+ }
22
25
  let included = false;
23
26
  let doc_ = doc._doc;
24
27
  for (let j = 0; j < len; ++j) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mongoose",
3
3
  "description": "Mongoose MongoDB ODM",
4
- "version": "8.9.6",
4
+ "version": "8.9.7",
5
5
  "author": "Guillermo Rauch <guillermo@learnboost.com>",
6
6
  "keywords": [
7
7
  "mongodb",
@@ -28,8 +28,8 @@
28
28
  "sift": "17.1.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@babel/core": "7.26.0",
32
- "@babel/preset-env": "7.26.0",
31
+ "@babel/core": "7.26.7",
32
+ "@babel/preset-env": "7.26.7",
33
33
  "@typescript-eslint/eslint-plugin": "^8.19.1",
34
34
  "@typescript-eslint/parser": "^8.19.1",
35
35
  "acquit": "1.3.0",
@@ -46,14 +46,14 @@
46
46
  "eslint-plugin-markdown": "^5.1.0",
47
47
  "eslint-plugin-mocha-no-only": "1.2.0",
48
48
  "express": "^4.19.2",
49
- "fs-extra": "~11.2.0",
49
+ "fs-extra": "~11.3.0",
50
50
  "highlight.js": "11.11.1",
51
51
  "lodash.isequal": "4.5.0",
52
52
  "lodash.isequalwith": "4.4.0",
53
53
  "markdownlint-cli2": "^0.17.1",
54
- "marked": "15.0.4",
54
+ "marked": "15.0.6",
55
55
  "mkdirp": "^3.0.1",
56
- "mocha": "11.0.1",
56
+ "mocha": "11.1.0",
57
57
  "moment": "2.30.1",
58
58
  "mongodb-memory-server": "10.1.3",
59
59
  "ncp": "^2.0.0",
@@ -63,8 +63,8 @@
63
63
  "sinon": "19.0.2",
64
64
  "stream-browserify": "3.0.0",
65
65
  "tsd": "0.31.2",
66
- "typescript": "5.7.2",
67
- "uuid": "11.0.3",
66
+ "typescript": "5.7.3",
67
+ "uuid": "11.0.5",
68
68
  "webpack": "5.97.1"
69
69
  },
70
70
  "directories": {
@@ -2301,6 +2301,18 @@ declare module 'mongoose' {
2301
2301
  }
2302
2302
  }
2303
2303
 
2304
+ export interface Median {
2305
+ /**
2306
+ * Returns an approximation of the median, the 50th percentile, as a scalar value.
2307
+ *
2308
+ * @see https://www.mongodb.com/docs/v7.0/reference/operator/aggregation/median/
2309
+ */
2310
+ $median: {
2311
+ input: number | Expression,
2312
+ method: 'approximate'
2313
+ }
2314
+ }
2315
+
2304
2316
  export interface StdDevPop {
2305
2317
  /**
2306
2318
  * Calculates the population standard deviation of the input values. Use if the values encompass the entire
@@ -2859,6 +2871,7 @@ declare module 'mongoose' {
2859
2871
  Expression.Locf |
2860
2872
  Expression.Max |
2861
2873
  Expression.MaxN |
2874
+ Expression.Median |
2862
2875
  Expression.Min |
2863
2876
  Expression.MinN |
2864
2877
  Expression.Push |
@@ -2891,6 +2904,7 @@ declare module 'mongoose' {
2891
2904
  Expression.ExpMovingAvg |
2892
2905
  Expression.Integral |
2893
2906
  Expression.Max |
2907
+ Expression.Median |
2894
2908
  Expression.Min |
2895
2909
  Expression.StdDevPop |
2896
2910
  Expression.StdDevSamp |
@@ -2963,6 +2977,7 @@ declare module 'mongoose' {
2963
2977
  Expression.LastN |
2964
2978
  Expression.Max |
2965
2979
  Expression.MaxN |
2980
+ Expression.Median |
2966
2981
  Expression.MergeObjects |
2967
2982
  Expression.Min |
2968
2983
  Expression.MinN |