Comparing version 8.9.0 to 8.9.1
@@ -49,3 +49,2 @@ /** | ||
module.exports.Number = mongoose.Number; | ||
module.exports.Double = mongoose.Double; | ||
module.exports.Error = mongoose.Error; | ||
@@ -52,0 +51,0 @@ module.exports.MongooseError = mongoose.MongooseError; |
@@ -161,3 +161,3 @@ 'use strict'; | ||
Connection.prototype.get = function(key) { | ||
Connection.prototype.get = function getOption(key) { | ||
if (this.config.hasOwnProperty(key)) { | ||
@@ -190,3 +190,3 @@ return this.config[key]; | ||
Connection.prototype.set = function(key, val) { | ||
Connection.prototype.set = function setOption(key, val) { | ||
if (this.config.hasOwnProperty(key)) { | ||
@@ -930,3 +930,3 @@ this.config[key] = val; | ||
Connection.prototype.error = function(err, callback) { | ||
Connection.prototype.error = function error(err, callback) { | ||
if (callback) { | ||
@@ -945,2 +945,3 @@ callback(err); | ||
* | ||
* @emits "open" | ||
* @api private | ||
@@ -1050,7 +1051,17 @@ */ | ||
/*! | ||
* Treat `on('error')` handlers as handling the initialConnection promise | ||
* to avoid uncaught exceptions when using `on('error')`. See gh-14377. | ||
/** | ||
* Listen to events in the Connection | ||
* | ||
* @param {String} event The event to listen on | ||
* @param {Function} callback | ||
* @see Connection#readyState https://mongoosejs.com/docs/api/connection.html#Connection.prototype.readyState | ||
* | ||
* @method on | ||
* @instance | ||
* @memberOf Connection | ||
* @api public | ||
*/ | ||
// Treat `on('error')` handlers as handling the initialConnection promise | ||
// to avoid uncaught exceptions when using `on('error')`. See gh-14377. | ||
Connection.prototype.on = function on(event, callback) { | ||
@@ -1063,7 +1074,17 @@ if (event === 'error' && this.$initialConnection) { | ||
/*! | ||
* Treat `once('error')` handlers as handling the initialConnection promise | ||
* to avoid uncaught exceptions when using `on('error')`. See gh-14377. | ||
/** | ||
* Listen to a event once in the Connection | ||
* | ||
* @param {String} event The event to listen on | ||
* @param {Function} callback | ||
* @see Connection#readyState https://mongoosejs.com/docs/api/connection.html#Connection.prototype.readyState | ||
* | ||
* @method once | ||
* @instance | ||
* @memberOf Connection | ||
* @api public | ||
*/ | ||
// Treat `on('error')` handlers as handling the initialConnection promise | ||
// to avoid uncaught exceptions when using `on('error')`. See gh-14377. | ||
Connection.prototype.once = function on(event, callback) { | ||
@@ -1229,3 +1250,3 @@ if (event === 'error' && this.$initialConnection) { | ||
Connection.prototype.doClose = function() { | ||
Connection.prototype.doClose = function doClose() { | ||
throw new Error('Connection#doClose unimplemented by driver'); | ||
@@ -1237,6 +1258,7 @@ }; | ||
* | ||
* @emits "close" | ||
* @api private | ||
*/ | ||
Connection.prototype.onClose = function(force) { | ||
Connection.prototype.onClose = function onClose(force) { | ||
this.readyState = STATES.disconnected; | ||
@@ -1345,3 +1367,3 @@ | ||
Connection.prototype.model = function(name, schema, collection, options) { | ||
Connection.prototype.model = function model(name, schema, collection, options) { | ||
if (!(this instanceof Connection)) { | ||
@@ -1466,3 +1488,3 @@ throw new MongooseError('`connection.model()` should not be run with ' + | ||
Connection.prototype.deleteModel = function(name) { | ||
Connection.prototype.deleteModel = function deleteModel(name) { | ||
if (typeof name === 'string') { | ||
@@ -1523,3 +1545,3 @@ const model = this.model(name); | ||
Connection.prototype.watch = function(pipeline, options) { | ||
Connection.prototype.watch = function watch(pipeline, options) { | ||
const changeStreamThunk = cb => { | ||
@@ -1573,3 +1595,3 @@ immediate(() => { | ||
Connection.prototype.modelNames = function() { | ||
Connection.prototype.modelNames = function modelNames() { | ||
return Object.keys(this.models); | ||
@@ -1586,3 +1608,3 @@ }; | ||
*/ | ||
Connection.prototype.shouldAuthenticate = function() { | ||
Connection.prototype.shouldAuthenticate = function shouldAuthenticate() { | ||
return this.user != null && | ||
@@ -1600,3 +1622,3 @@ (this.pass != null || this.authMechanismDoesNotRequirePassword()); | ||
*/ | ||
Connection.prototype.authMechanismDoesNotRequirePassword = function() { | ||
Connection.prototype.authMechanismDoesNotRequirePassword = function authMechanismDoesNotRequirePassword() { | ||
if (this.options && this.options.auth) { | ||
@@ -1619,3 +1641,3 @@ return noPasswordAuthMechanisms.indexOf(this.options.auth.authMechanism) >= 0; | ||
*/ | ||
Connection.prototype.optionsProvideAuthenticationData = function(options) { | ||
Connection.prototype.optionsProvideAuthenticationData = function optionsProvideAuthenticationData(options) { | ||
return (options) && | ||
@@ -1622,0 +1644,0 @@ (options.user) && |
@@ -178,7 +178,6 @@ /*! | ||
* | ||
* @param {Function} callback | ||
* @return {Promise} | ||
* @api public | ||
* @method close | ||
* @emits close | ||
* @emits "close" | ||
* @see AggregationCursor.close https://mongodb.github.io/node-mongodb-native/4.9/classes/AggregationCursor.html#close | ||
@@ -185,0 +184,0 @@ */ |
@@ -457,3 +457,2 @@ 'use strict'; | ||
* | ||
* @param {Function} callback | ||
* @method getIndexes | ||
@@ -460,0 +459,0 @@ * @api public |
@@ -122,2 +122,3 @@ 'use strict'; | ||
mergeDiscriminatorSchema(schema, baseSchema); | ||
schema._gatherChildSchemas(); | ||
@@ -124,0 +125,0 @@ // Clean up conflicting paths _after_ merging re: gh-6076 |
@@ -248,3 +248,3 @@ 'use strict'; | ||
Mongoose.prototype.set = function(key, value) { | ||
Mongoose.prototype.set = function getsetOptions(key, value) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -380,3 +380,3 @@ | ||
Mongoose.prototype.createConnection = function(uri, options) { | ||
Mongoose.prototype.createConnection = function createConnection(uri, options) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -432,3 +432,2 @@ | ||
* @param {Boolean} [options.autoCreate=false] Set to `true` to make Mongoose automatically call `createCollection()` on every model created on this connection. | ||
* @param {Function} [callback] | ||
* @see Mongoose#createConnection https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.createConnection() | ||
@@ -485,3 +484,2 @@ * @api public | ||
* @param {Boolean} [options.causalConsistency=true] set to false to disable causal consistency | ||
* @param {Function} [callback] | ||
* @return {Promise<ClientSession>} promise that resolves to a MongoDB driver `ClientSession` | ||
@@ -491,3 +489,3 @@ * @api public | ||
Mongoose.prototype.startSession = function() { | ||
Mongoose.prototype.startSession = function startSession() { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -506,3 +504,3 @@ | ||
Mongoose.prototype.pluralize = function(fn) { | ||
Mongoose.prototype.pluralize = function pluralize(fn) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -570,3 +568,3 @@ | ||
Mongoose.prototype.model = function(name, schema, collection, options) { | ||
Mongoose.prototype.model = function model(name, schema, collection, options) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -582,3 +580,3 @@ | ||
if (!model) { | ||
throw new MongooseError.MissingSchemaError(name); | ||
throw new _mongoose.Error.MissingSchemaError(name); | ||
} | ||
@@ -592,3 +590,3 @@ return model; | ||
if (schema && !(schema instanceof Schema)) { | ||
throw new Error('The 2nd parameter to `mongoose.model()` should be a ' + | ||
throw new _mongoose.Error('The 2nd parameter to `mongoose.model()` should be a ' + | ||
'schema or a POJO'); | ||
@@ -644,3 +642,3 @@ } | ||
Mongoose.prototype._model = function(name, schema, collection, options) { | ||
Mongoose.prototype._model = function _model(name, schema, collection, options) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -720,3 +718,3 @@ | ||
Mongoose.prototype.deleteModel = function(name) { | ||
Mongoose.prototype.deleteModel = function deleteModel(name) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -740,3 +738,3 @@ | ||
Mongoose.prototype.modelNames = function() { | ||
Mongoose.prototype.modelNames = function modelNames() { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -755,3 +753,3 @@ | ||
Mongoose.prototype._applyPlugins = function(schema, options) { | ||
Mongoose.prototype._applyPlugins = function _applyPlugins(schema, options) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -779,3 +777,3 @@ | ||
Mongoose.prototype.plugin = function(fn, opts) { | ||
Mongoose.prototype.plugin = function plugin(fn, opts) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -1090,3 +1088,3 @@ | ||
Mongoose.prototype.isValidObjectId = function(v) { | ||
Mongoose.prototype.isValidObjectId = function isValidObjectId(v) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -1123,3 +1121,3 @@ return _mongoose.Types.ObjectId.isValid(v); | ||
Mongoose.prototype.isObjectIdOrHexString = function(v) { | ||
Mongoose.prototype.isObjectIdOrHexString = function isObjectIdOrHexString(v) { | ||
return isBsonType(v, 'ObjectId') || (typeof v === 'string' && objectIdHexRegexp.test(v)); | ||
@@ -1136,3 +1134,3 @@ }; | ||
*/ | ||
Mongoose.prototype.syncIndexes = function(options) { | ||
Mongoose.prototype.syncIndexes = function syncIndexes(options) { | ||
const _mongoose = this instanceof Mongoose ? this : mongoose; | ||
@@ -1212,4 +1210,4 @@ return _mongoose.connection.syncIndexes(options); | ||
Mongoose.prototype.Error = require('./error/index'); | ||
Mongoose.prototype.MongooseError = require('./error/mongooseError'); | ||
Mongoose.prototype.Error = MongooseError; | ||
Mongoose.prototype.MongooseError = MongooseError; | ||
@@ -1239,3 +1237,3 @@ /** | ||
Mongoose.prototype.CastError = require('./error/cast'); | ||
Mongoose.prototype.CastError = MongooseError.CastError; | ||
@@ -1242,0 +1240,0 @@ /** |
@@ -184,7 +184,7 @@ 'use strict'; | ||
* const m = new M({ state: 'invalid' }) | ||
* m.save(function (err) { | ||
* console.error(String(err)) // ValidationError: `invalid` is not a valid enum value for path `state`. | ||
* m.state = 'open' | ||
* m.save(callback) // success | ||
* }) | ||
* await m.save() | ||
* .catch((err) => console.error(err)); // ValidationError: `invalid` is not a valid enum value for path `state`. | ||
* m.state = 'open'; | ||
* await m.save(); | ||
* // success | ||
* | ||
@@ -199,7 +199,7 @@ * // or with custom error messages | ||
* const m = new M({ state: 'invalid' }) | ||
* m.save(function (err) { | ||
* console.error(String(err)) // ValidationError: enum validator failed for path `state` with value `invalid` | ||
* m.state = 'open' | ||
* m.save(callback) // success | ||
* }) | ||
* await m.save() | ||
* .catch((err) => console.error(err)); // ValidationError: enum validator failed for path `state` with value `invalid` | ||
* m.state = 'open'; | ||
* await m.save(); | ||
* // success | ||
* | ||
@@ -206,0 +206,0 @@ * @param {...String|Object} [args] enumeration values |
{ | ||
"name": "mongoose", | ||
"description": "Mongoose MongoDB ODM", | ||
"version": "8.9.0", | ||
"version": "8.9.1", | ||
"author": "Guillermo Rauch <guillermo@learnboost.com>", | ||
@@ -33,4 +33,4 @@ "keywords": [ | ||
"@babel/preset-env": "7.26.0", | ||
"@typescript-eslint/eslint-plugin": "^8.4.0", | ||
"@typescript-eslint/parser": "^8.4.0", | ||
"@typescript-eslint/eslint-plugin": "^8.18.0", | ||
"@typescript-eslint/parser": "^8.18.0", | ||
"acquit": "1.3.0", | ||
@@ -37,0 +37,0 @@ "acquit-ignore": "0.2.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2793571
52934
4