You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+18
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,21 @@
1
+
8.1.2 / 2024-02-08
2
+
==================
3
+
* fix: include virtuals in document array toString() output if toObject.virtuals set #14335#14315
4
+
* fix(document): handle setting nested path to spread doc with extra properties #14287#14269
5
+
* fix(populate): call setter on virtual populated path with populated doc instead of undefined #14314
6
+
* fix(QueryCursor): remove callback parameter of AggregationCursor and QueryCursor #14299[DevooKim](https://github.com/DevooKim)
7
+
* types: add typescript support for arbitrary fields for the options parameter of Model functions which are of type MongooseQueryOptions #14342#14341[FaizBShah](https://github.com/FaizBShah)
8
+
* types(model): correct return type for findOneAndUpdate with includeResultMetadata and lean set #14336#14303
9
+
* types(connection): add type definition for `createCollections()`#14295#14279
10
+
* docs(timestamps): clarify that replaceOne() and findOneAndReplace() overwrite timestamps #14337#14309
11
+
12
+
8.1.1 / 2024-01-24
13
+
==================
14
+
* fix(model): throw readable error when calling Model() with a string instead of model() #14288#14281
15
+
* fix(document): handle setting nested path to spread doc with extra properties #14287#14269
16
+
* types(query): add back context and setDefaultsOnInsert as Mongoose-specific query options #14284#14282
17
+
* types(query): add missing runValidators back to MongooseQueryOptions #14278#14275
Copy file name to clipboardExpand all lines: docs/migrating_to_7.md
+3
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,8 @@ They always return promises.
87
87
*`Aggregate.prototype.exec`
88
88
*`Aggregate.prototype.explain`
89
89
*`AggregationCursor.prototype.close`
90
+
*`AggregationCursor.prototype.next`
91
+
*`AggregationCursor.prototype.eachAsync`
90
92
*`Connection.prototype.startSession`
91
93
*`Connection.prototype.dropCollection`
92
94
*`Connection.prototype.createCollection`
@@ -138,6 +140,7 @@ They always return promises.
138
140
*`Query.prototype.exec`
139
141
*`QueryCursor.prototype.close`
140
142
*`QueryCursor.prototype.next`
143
+
*`QueryCursor.prototype.eachAsync`
141
144
142
145
If you are using the above functions with callbacks, we recommend switching to async/await, or promises if async functions don't work for you.
143
146
If you need help refactoring a legacy codebase, [this tool from Mastering JS callbacks to async await](https://masteringjs.io/tutorials/tools/callback-to-async-await) using ChatGPT.
@@ -219,21 +227,24 @@ AggregationCursor.prototype.next = async function next() {
219
227
* @param {Function} fn
220
228
* @param {Object} [options]
221
229
* @param {Number} [options.parallel] the number of promises to execute in parallel. Defaults to 1.
222
-
* @param {Function} [callback] executed when all docs have been processed
230
+
* @param {Number} [options.batchSize=null] if set, Mongoose will call `fn` with an array of at most `batchSize` documents, instead of a single document
231
+
* @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.
thrownewMongooseError('QueryCursor.prototype.next() no longer accepts a callback');
248
248
}
249
249
returnnewPromise((resolve,reject)=>{
@@ -277,20 +277,21 @@ QueryCursor.prototype.next = async function next() {
277
277
* @param {Number} [options.parallel] the number of promises to execute in parallel. Defaults to 1.
278
278
* @param {Number} [options.batchSize] if set, will call `fn()` with arrays of documents with length at most `batchSize`
279
279
* @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.
280
-
* @param {Function} [callback] executed when all docs have been processed
0 commit comments