Comparing version 8.1.1 to 8.1.2
@@ -222,3 +222,4 @@ /*! | ||
* @param {Number} [options.parallel] the number of promises to execute in parallel. Defaults to 1. | ||
* @param {Function} [callback] executed when all docs have been processed | ||
* @param {Number} [options.batchSize=null] if set, Mongoose will call `fn` with an array of at most `batchSize` documents, instead of a single document | ||
* @param {Boolean} [options.continueOnError=false] if true, `eachAsync()` iterates through all docs even if `fn` throws an error. If false, `eachAsync()` throws an error immediately if the given function `fn()` throws an error. | ||
* @return {Promise} | ||
@@ -229,6 +230,8 @@ * @api public | ||
AggregationCursor.prototype.eachAsync = function(fn, opts, callback) { | ||
AggregationCursor.prototype.eachAsync = function(fn, opts) { | ||
if (typeof arguments[2] === 'function') { | ||
throw new MongooseError('AggregationCursor.prototype.eachAsync() no longer accepts a callback'); | ||
} | ||
const _this = this; | ||
if (typeof opts === 'function') { | ||
callback = opts; | ||
opts = {}; | ||
@@ -238,3 +241,3 @@ } | ||
return eachAsync(function(cb) { return _next(_this, cb); }, fn, opts, callback); | ||
return eachAsync(function(cb) { return _next(_this, cb); }, fn, opts); | ||
}; | ||
@@ -241,0 +244,0 @@ |
@@ -246,3 +246,3 @@ /*! | ||
QueryCursor.prototype.next = async function next() { | ||
if (arguments[0] === 'function') { | ||
if (typeof arguments[0] === 'function') { | ||
throw new MongooseError('QueryCursor.prototype.next() no longer accepts a callback'); | ||
@@ -281,3 +281,2 @@ } | ||
* @param {Boolean} [options.continueOnError=false] if true, `eachAsync()` iterates through all docs even if `fn` throws an error. If false, `eachAsync()` throws an error immediately if the given function `fn()` throws an error. | ||
* @param {Function} [callback] executed when all docs have been processed | ||
* @return {Promise} | ||
@@ -288,5 +287,7 @@ * @api public | ||
QueryCursor.prototype.eachAsync = function(fn, opts, callback) { | ||
QueryCursor.prototype.eachAsync = function(fn, opts) { | ||
if (typeof arguments[2] === 'function') { | ||
throw new MongooseError('QueryCursor.prototype.eachAsync() no longer accepts a callback'); | ||
} | ||
if (typeof opts === 'function') { | ||
callback = opts; | ||
opts = {}; | ||
@@ -296,3 +297,3 @@ } | ||
return eachAsync((cb) => _next(this, cb), fn, opts, callback); | ||
return eachAsync((cb) => _next(this, cb), fn, opts); | ||
}; | ||
@@ -299,0 +300,0 @@ |
@@ -16,2 +16,4 @@ 'use strict'; | ||
const _baseToString = Array.prototype.toString; | ||
const methods = { | ||
@@ -26,2 +28,11 @@ /*! | ||
toString() { | ||
return _baseToString.call(this.__array.map(subdoc => { | ||
if (subdoc != null && subdoc.$__ != null) { | ||
return subdoc.toString(); | ||
} | ||
return subdoc; | ||
})); | ||
}, | ||
/*! | ||
@@ -28,0 +39,0 @@ * ignore |
@@ -403,7 +403,3 @@ 'use strict'; | ||
Subdocument.prototype.inspect = function() { | ||
return this.toObject({ | ||
transform: false, | ||
virtuals: false, | ||
flattenDecimals: false | ||
}); | ||
return this.toObject(); | ||
}; | ||
@@ -410,0 +406,0 @@ |
{ | ||
"name": "mongoose", | ||
"description": "Mongoose MongoDB ODM", | ||
"version": "8.1.1", | ||
"version": "8.1.2", | ||
"author": "Guillermo Rauch <guillermo@learnboost.com>", | ||
@@ -31,4 +31,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/core": "7.23.7", | ||
"@babel/preset-env": "7.23.7", | ||
"@babel/core": "7.23.9", | ||
"@babel/preset-env": "7.23.9", | ||
"@typescript-eslint/eslint-plugin": "^6.2.1", | ||
@@ -47,3 +47,3 @@ "@typescript-eslint/parser": "^6.2.1", | ||
"crypto-browserify": "3.12.0", | ||
"dotenv": "16.3.1", | ||
"dotenv": "16.4.1", | ||
"dox": "1.0.0", | ||
@@ -58,3 +58,3 @@ "eslint": "8.56.0", | ||
"lodash.isequalwith": "4.4.0", | ||
"markdownlint-cli2": "^0.11.0", | ||
"markdownlint-cli2": "^0.12.1", | ||
"marked": "4.3.0", | ||
@@ -71,6 +71,6 @@ "mkdirp": "^3.0.1", | ||
"stream-browserify": "3.0.0", | ||
"tsd": "0.30.3", | ||
"tsd": "0.30.4", | ||
"typescript": "5.3.3", | ||
"uuid": "9.0.1", | ||
"webpack": "5.89.0" | ||
"webpack": "5.90.1" | ||
}, | ||
@@ -77,0 +77,0 @@ "directories": { |
@@ -85,2 +85,7 @@ declare module 'mongoose' { | ||
/** | ||
* https://mongoosejs.com/docs/api/connection.html#Connection.prototype.createCollections() | ||
*/ | ||
createCollections(continueOnError?: boolean): Promise<Record<string, Error | mongodb.Collection<any>>>; | ||
/** | ||
* Removes the model named `name` from this connection, if it exists. You can | ||
@@ -87,0 +92,0 @@ * use this function to clean up any models you created in your tests to |
@@ -596,2 +596,13 @@ declare module 'mongoose' { | ||
findByIdAndUpdate<ResultDoc = THydratedDocumentType>( | ||
filter: FilterQuery<TRawDocType>, | ||
update: UpdateQuery<TRawDocType>, | ||
options: QueryOptions<TRawDocType> & { includeResultMetadata: true, lean: true } | ||
): QueryWithHelpers< | ||
ModifyResult<TRawDocType>, | ||
ResultDoc, | ||
TQueryHelpers, | ||
TRawDocType, | ||
'findOneAndUpdate' | ||
>; | ||
findByIdAndUpdate<ResultDoc = THydratedDocumentType>( | ||
id: mongodb.ObjectId | any, | ||
@@ -679,5 +690,5 @@ update: UpdateQuery<TRawDocType>, | ||
update: UpdateQuery<TRawDocType>, | ||
options: QueryOptions<TRawDocType> & { lean: true } | ||
options: QueryOptions<TRawDocType> & { includeResultMetadata: true, lean: true } | ||
): QueryWithHelpers< | ||
GetLeanResultType<TRawDocType, TRawDocType, 'findOneAndUpdate'> | null, | ||
ModifyResult<TRawDocType>, | ||
ResultDoc, | ||
@@ -691,4 +702,10 @@ TQueryHelpers, | ||
update: UpdateQuery<TRawDocType>, | ||
options: QueryOptions<TRawDocType> & { includeResultMetadata: true } | ||
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate'>; | ||
options: QueryOptions<TRawDocType> & { lean: true } | ||
): QueryWithHelpers< | ||
GetLeanResultType<TRawDocType, TRawDocType, 'findOneAndUpdate'> | null, | ||
ResultDoc, | ||
TQueryHelpers, | ||
TRawDocType, | ||
'findOneAndUpdate' | ||
>; | ||
findOneAndUpdate<ResultDoc = THydratedDocumentType>( | ||
@@ -695,0 +712,0 @@ filter: FilterQuery<TRawDocType>, |
@@ -35,3 +35,5 @@ declare module 'mongoose' { | ||
'translateAliases' | ||
>; | ||
> & { | ||
[other: string]: any; | ||
}; | ||
@@ -38,0 +40,0 @@ type ProjectionFields<DocType> = { [Key in keyof DocType]?: any } & Record<string, any>; |
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
2662928
284
49669