mongoose 6.7.4 → 6.7.5

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.
@@ -23,5 +23,6 @@ module.exports = function merge(s1, s2, skipConflictingPaths) {
23
23
  s1.virtuals[virtual] = s2.virtuals[virtual].clone();
24
24
  }
25
25
 
26
+ s1._indexes = s1._indexes.concat(s2._indexes || []);
26
27
  s1.s.hooks.merge(s2.s.hooks, false);
27
28
  };
@@ -163,6 +163,11 @@ exports.applyPaths = function applyPaths(fields, schema) {
163
163
  if (!isDefiningProjection(field)) {
164
164
  continue;
165
165
  }
166
+ // `_id: 1, name: 0` is a mixed inclusive/exclusive projection in
167
+ // MongoDB 4.0 and earlier, but not in later versions.
168
+ if (keys[keyIndex] === '_id' && keys.length > 1) {
169
+ continue;
170
+ }
166
171
  exclude = !field;
167
172
  break;
168
173
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mongoose",
3
3
  "description": "Mongoose MongoDB ODM",
4
- "version": "6.7.4",
4
+ "version": "6.7.5",
5
5
  "author": "Guillermo Rauch <guillermo@learnboost.com>",
6
6
  "keywords": [
7
7
  "mongodb",
package/types/index.d.ts CHANGED
@@ -496,7 +496,12 @@ declare module 'mongoose' {
496
496
  $pullAll?: AnyKeys<TSchema> & AnyObject;
497
497
 
498
498
  /** @see https://docs.mongodb.com/manual/reference/operator/update-bitwise/ */
499
- $bit?: Record<string, mongodb.NumericType>;
499
+ // Needs to be `AnyKeys` for now, because anything stricter makes us incompatible
500
+ // with the MongoDB Node driver's `UpdateFilter` interface (see gh-12595, gh-11911)
501
+ // and using the Node driver's `$bit` definition breaks because their `OnlyFieldsOfType`
502
+ // interface breaks on Mongoose Document class due to circular references.
503
+ // Re-evaluate this when we drop `extends Document` support in document interfaces.
504
+ $bit?: AnyKeys<TSchema>;
500
505
  };
501
506
 
502
507
  export type UpdateWithAggregationPipeline = UpdateAggregationStage[];