mongodb 6.13.0-dev.20250205.sha.3a4edd51 → 6.13.0-dev.20250206.sha.1d0b2b44

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.
Files changed (46) hide show
  1. package/lib/beta.d.ts +2 -1
  2. package/lib/change_stream.js +4 -5
  3. package/lib/change_stream.js.map +1 -1
  4. package/lib/client-side-encryption/state_machine.js +0 -1
  5. package/lib/client-side-encryption/state_machine.js.map +1 -1
  6. package/lib/cmap/connect.js +0 -1
  7. package/lib/cmap/connect.js.map +1 -1
  8. package/lib/cmap/connection.js +1 -0
  9. package/lib/cmap/connection.js.map +1 -1
  10. package/lib/cmap/connection_pool.js +1 -0
  11. package/lib/cmap/connection_pool.js.map +1 -1
  12. package/lib/cursor/abstract_cursor.js +1 -0
  13. package/lib/cursor/abstract_cursor.js.map +1 -1
  14. package/lib/gridfs/index.js +1 -0
  15. package/lib/gridfs/index.js.map +1 -1
  16. package/lib/mongo_client.js +1 -0
  17. package/lib/mongo_client.js.map +1 -1
  18. package/lib/mongo_types.js +5 -0
  19. package/lib/mongo_types.js.map +1 -1
  20. package/lib/sdam/monitor.js +1 -0
  21. package/lib/sdam/monitor.js.map +1 -1
  22. package/lib/sdam/server.js +1 -0
  23. package/lib/sdam/server.js.map +1 -1
  24. package/lib/sdam/srv_polling.js +1 -0
  25. package/lib/sdam/srv_polling.js.map +1 -1
  26. package/lib/sdam/topology.js +1 -0
  27. package/lib/sdam/topology.js.map +1 -1
  28. package/lib/sessions.js +1 -0
  29. package/lib/sessions.js.map +1 -1
  30. package/mongodb.d.ts +2 -1
  31. package/package.json +1 -1
  32. package/src/change_stream.ts +4 -6
  33. package/src/client-side-encryption/state_machine.ts +0 -1
  34. package/src/cmap/connect.ts +0 -1
  35. package/src/cmap/connection.ts +2 -0
  36. package/src/cmap/connection_pool.ts +2 -0
  37. package/src/collection.ts +1 -1
  38. package/src/cursor/abstract_cursor.ts +2 -0
  39. package/src/gridfs/index.ts +2 -1
  40. package/src/mongo_client.ts +2 -0
  41. package/src/mongo_types.ts +7 -1
  42. package/src/sdam/monitor.ts +2 -0
  43. package/src/sdam/server.ts +2 -0
  44. package/src/sdam/srv_polling.ts +2 -1
  45. package/src/sdam/topology.ts +2 -0
  46. package/src/sessions.ts +2 -0
@@ -34,6 +34,7 @@ import {
34
34
  kDispose,
35
35
  List,
36
36
  makeCounter,
37
+ noop,
37
38
  now,
38
39
  promiseWithResolvers
39
40
  } from '../utils';
@@ -200,6 +201,7 @@ export class ConnectionPool extends TypedEventEmitter<ConnectionPoolEvents> {
200
201
 
201
202
  constructor(server: Server, options: ConnectionPoolOptions) {
202
203
  super();
204
+ this.on('error', noop);
203
205
 
204
206
  this.options = Object.freeze({
205
207
  connectionType: Connection,
package/src/collection.ts CHANGED
@@ -389,7 +389,7 @@ export class Collection<TSchema extends Document = Document> {
389
389
  filter: Filter<TSchema>,
390
390
  replacement: WithoutId<TSchema>,
391
391
  options?: ReplaceOptions
392
- ): Promise<UpdateResult<TSchema> | Document> {
392
+ ): Promise<UpdateResult<TSchema>> {
393
393
  return await executeOperation(
394
394
  this.client,
395
395
  new ReplaceOneOperation(
@@ -27,6 +27,7 @@ import {
27
27
  type Disposable,
28
28
  kDispose,
29
29
  type MongoDBNamespace,
30
+ noop,
30
31
  squashError
31
32
  } from '../utils';
32
33
 
@@ -267,6 +268,7 @@ export abstract class AbstractCursor<
267
268
  options: AbstractCursorOptions & Abortable = {}
268
269
  ) {
269
270
  super();
271
+ this.on('error', noop);
270
272
 
271
273
  if (!client.s.isMongoClient) {
272
274
  throw new MongoRuntimeError('Cursor must be constructed with MongoClient');
@@ -7,7 +7,7 @@ import { type Filter, TypedEventEmitter } from '../mongo_types';
7
7
  import type { ReadPreference } from '../read_preference';
8
8
  import type { Sort } from '../sort';
9
9
  import { CSOTTimeoutContext } from '../timeout';
10
- import { resolveOptions } from '../utils';
10
+ import { noop, resolveOptions } from '../utils';
11
11
  import { WriteConcern, type WriteConcernOptions } from '../write_concern';
12
12
  import type { FindOptions } from './../operations/find';
13
13
  import {
@@ -87,6 +87,7 @@ export class GridFSBucket extends TypedEventEmitter<GridFSBucketEvents> {
87
87
 
88
88
  constructor(db: Db, options?: GridFSBucketOptions) {
89
89
  super();
90
+ this.on('error', noop);
90
91
  this.setMaxListeners(0);
91
92
  const privateOptions = resolveOptions(db, {
92
93
  ...DEFAULT_GRIDFS_BUCKET_OPTIONS,
@@ -57,6 +57,7 @@ import {
57
57
  hostMatchesWildcards,
58
58
  isHostMatch,
59
59
  type MongoDBNamespace,
60
+ noop,
60
61
  ns,
61
62
  resolveOptions,
62
63
  squashError
@@ -381,6 +382,7 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
381
382
 
382
383
  constructor(url: string, options?: MongoClientOptions) {
383
384
  super();
385
+ this.on('error', noop);
384
386
 
385
387
  this.options = parseOptions(url, this, options);
386
388
 
@@ -24,6 +24,7 @@ import {
24
24
  type MongoLogger
25
25
  } from './mongo_logger';
26
26
  import type { Sort } from './sort';
27
+ import { noop } from './utils';
27
28
 
28
29
  /** @internal */
29
30
  export type TODO_NODE_3286 = any;
@@ -472,7 +473,12 @@ export class TypedEventEmitter<Events extends EventsDescription> extends EventEm
472
473
  }
473
474
 
474
475
  /** @public */
475
- export class CancellationToken extends TypedEventEmitter<{ cancel(): void }> {}
476
+ export class CancellationToken extends TypedEventEmitter<{ cancel(): void }> {
477
+ constructor(...args: any[]) {
478
+ super(...args);
479
+ this.on('error', noop);
480
+ }
481
+ }
476
482
 
477
483
  /** @public */
478
484
  export type Abortable = {
@@ -13,6 +13,7 @@ import {
13
13
  type Callback,
14
14
  type EventEmitterWithState,
15
15
  makeStateMachine,
16
+ noop,
16
17
  now,
17
18
  ns
18
19
  } from '../utils';
@@ -102,6 +103,7 @@ export class Monitor extends TypedEventEmitter<MonitorEvents> {
102
103
 
103
104
  constructor(server: Server, options: MonitorOptions) {
104
105
  super();
106
+ this.on('error', noop);
105
107
 
106
108
  this.server = server;
107
109
  this.connection = null;
@@ -47,6 +47,7 @@ import {
47
47
  makeStateMachine,
48
48
  maxWireVersion,
49
49
  type MongoDBNamespace,
50
+ noop,
50
51
  supportsRetryableWrites
51
52
  } from '../utils';
52
53
  import { throwIfWriteConcernError } from '../write_concern';
@@ -142,6 +143,7 @@ export class Server extends TypedEventEmitter<ServerEvents> {
142
143
  */
143
144
  constructor(topology: Topology, description: ServerDescription, options: ServerOptions) {
144
145
  super();
146
+ this.on('error', noop);
145
147
 
146
148
  this.serverApi = options.serverApi;
147
149
 
@@ -3,7 +3,7 @@ import { clearTimeout, setTimeout } from 'timers';
3
3
 
4
4
  import { MongoRuntimeError } from '../error';
5
5
  import { TypedEventEmitter } from '../mongo_types';
6
- import { checkParentDomainMatch, HostAddress, squashError } from '../utils';
6
+ import { checkParentDomainMatch, HostAddress, noop, squashError } from '../utils';
7
7
 
8
8
  /**
9
9
  * @internal
@@ -49,6 +49,7 @@ export class SrvPoller extends TypedEventEmitter<SrvPollerEvents> {
49
49
 
50
50
  constructor(options: SrvPollerOptions) {
51
51
  super();
52
+ this.on('error', noop);
52
53
 
53
54
  if (!options || !options.srvHost) {
54
55
  throw new MongoRuntimeError('Options for SrvPoller must exist and include srvHost');
@@ -44,6 +44,7 @@ import {
44
44
  kDispose,
45
45
  List,
46
46
  makeStateMachine,
47
+ noop,
47
48
  now,
48
49
  ns,
49
50
  promiseWithResolvers,
@@ -248,6 +249,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
248
249
  options: TopologyOptions
249
250
  ) {
250
251
  super();
252
+ this.on('error', noop);
251
253
 
252
254
  this.client = client;
253
255
  // Options should only be undefined in tests, MongoClient will always have defined options
package/src/sessions.ts CHANGED
@@ -43,6 +43,7 @@ import {
43
43
  isPromiseLike,
44
44
  List,
45
45
  maxWireVersion,
46
+ noop,
46
47
  now,
47
48
  squashError,
48
49
  uuidV4
@@ -161,6 +162,7 @@ export class ClientSession
161
162
  clientOptions: MongoOptions
162
163
  ) {
163
164
  super();
165
+ this.on('error', noop);
164
166
 
165
167
  if (client == null) {
166
168
  // TODO(NODE-3483)