Skip to content

Commit cce174c

Browse files
committed
docs(migrating_to_9): add note about removing noListener re: #15641
1 parent ac9c4b5 commit cce174c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/migrating_to_9.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,21 @@ In Mongoose 8, there was also an internal `$embeddedSchemaType` property. That p
290290
`mongoose.Query` had a `use$geoWithin` property that could configure converting `$geoWithin` to `$within` to support MongoDB versions before 2.4.
291291
That property has been removed in Mongoose 9. `$geoWithin` is now never converted to `$within`, because MongoDB no longer supports `$within`.
292292

293+
## Removed `noListener` option from `useDb()`/connections
294+
295+
The `noListener` option has been removed from connections and from the `useDb()` method. In Mongoose 8.x, you could call `useDb()` with `{ noListener: true }` to prevent the new connection object from listening to state changes on the base connection, which was sometimes useful to reduce memory usage when dynamically creating connections for every request.
296+
297+
In Mongoose 9.x, the `noListener` option is no longer supported or documented. The second argument to `useDb()` now only supports `{ useCache }`.
298+
299+
```javascript
300+
// Mongoose 8.x
301+
conn.useDb('myDb', { noListener: true }); // works
302+
303+
// Mongoose 9.x
304+
conn.useDb('myDb', { noListener: true }); // TypeError: noListener is not a supported option
305+
conn.useDb('myDb', { useCache: true }); // works
306+
```
307+
293308
## TypeScript
294309

295310
### FilterQuery renamed to QueryFilter

0 commit comments

Comments
 (0)