mongoose 6.6.4 → 6.6.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.
@@ -9,7 +9,7 @@ if (typeof jest !== 'undefined' && typeof window !== 'undefined') {
9
9
  'https://mongoosejs.com/docs/jest.html');
10
10
  }
11
11
 
12
- if (typeof jest !== 'undefined' && process.nextTick.toString().indexOf('nextTick') === -1) {
12
+ if (typeof jest !== 'undefined' && setTimeout.clock != null && typeof setTimeout.clock.Date === 'function') {
13
13
  utils.warn('Mongoose: looks like you\'re trying to test a Mongoose app ' +
14
14
  'with Jest\'s mock timers enabled. Please make sure you read ' +
15
15
  'Mongoose\'s docs on configuring Jest to test Node.js apps: ' +
@@ -172,6 +172,7 @@ SubdocumentPath.prototype.cast = function(val, doc, init, priorVal, options) {
172
172
  options = Object.assign({}, options, { priorDoc: priorVal });
173
173
  if (init) {
174
174
  subdoc = new Constructor(void 0, selected, doc, false, { defaults: false });
175
+ delete subdoc.$__.defaults;
175
176
  subdoc.$init(val);
176
177
  applyDefaults(subdoc, selected);
177
178
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mongoose",
3
3
  "description": "Mongoose MongoDB ODM",
4
- "version": "6.6.4",
4
+ "version": "6.6.5",
5
5
  "author": "Guillermo Rauch <guillermo@learnboost.com>",
6
6
  "keywords": [
7
7
  "mongodb",
package/types/index.d.ts CHANGED
@@ -208,7 +208,7 @@ declare module 'mongoose' {
208
208
  /** Returns a copy of this schema */
209
209
  clone<T = this>(): T;
210
210
 
211
- discriminator<DisSchema = Schema>(name: string, schema: DisSchema): DiscriminatorSchema<DocType, M, TInstanceMethods, TQueryHelpers, TVirtuals, TStaticMethods, DisSchema>;
211
+ discriminator<DisSchema = Schema>(name: string, schema: DisSchema): this;
212
212
 
213
213
  /** Returns a new schema that has the picked `paths` from this schema. */
214
214
  pick<T = this>(paths: string[], options?: SchemaOptions): T;
@@ -1,7 +1,7 @@
1
1
  declare module 'mongoose' {
2
2
 
3
3
  type MongooseDocumentMiddleware = 'validate' | 'save' | 'remove' | 'updateOne' | 'deleteOne' | 'init';
4
- type MongooseQueryMiddleware = 'count' | 'deleteMany' | 'deleteOne' | 'distinct' | 'find' | 'findOne' | 'findOneAndDelete' | 'findOneAndRemove' | 'findOneAndReplace' | 'findOneAndUpdate' | 'remove' | 'replaceOne' | 'update' | 'updateOne' | 'updateMany';
4
+ type MongooseQueryMiddleware = 'count' | 'estimatedDocumentCount' | 'countDocuments' | 'deleteMany' | 'deleteOne' | 'distinct' | 'find' | 'findOne' | 'findOneAndDelete' | 'findOneAndRemove' | 'findOneAndReplace' | 'findOneAndUpdate' | 'remove' | 'replaceOne' | 'update' | 'updateOne' | 'updateMany';
5
5
 
6
6
  type MiddlewareOptions = { document?: boolean, query?: boolean };
7
7
  type SchemaPreOptions = MiddlewareOptions;