mongodb 6.18.0-dev.20250724.sha.acd86250 → 6.18.0-dev.20250731.sha.c5365347

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.
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CollectionsOperation = void 0;
4
- const collection_1 = require("../collection");
5
- const operation_1 = require("./operation");
6
- /** @internal */
7
- class CollectionsOperation extends operation_1.AbstractOperation {
8
- constructor(db, options) {
9
- super(options);
10
- this.options = options;
11
- this.db = db;
12
- }
13
- get commandName() {
14
- return 'listCollections';
15
- }
16
- async execute(server, session) {
17
- // Let's get the collection names
18
- const documents = await this.db
19
- .listCollections({}, { ...this.options, nameOnly: true, readPreference: this.readPreference, session })
20
- .toArray();
21
- const collections = [];
22
- for (const { name } of documents) {
23
- if (!name.includes('$')) {
24
- // Filter collections removing any illegal ones
25
- collections.push(new collection_1.Collection(this.db, name, this.db.s.options));
26
- }
27
- }
28
- // Return the collection objects
29
- return collections;
30
- }
31
- }
32
- exports.CollectionsOperation = CollectionsOperation;
33
- //# sourceMappingURL=collections.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/operations/collections.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAI3C,2CAAuE;AAMvE,gBAAgB;AAChB,MAAa,oBAAqB,SAAQ,6BAA+B;IAIvE,YAAY,EAAM,EAAE,OAA2B;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,iBAA0B,CAAC;IACpC,CAAC;IAEQ,KAAK,CAAC,OAAO,CACpB,MAAc,EACd,OAAkC;QAElC,iCAAiC;QACjC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,EAAE;aAC5B,eAAe,CACd,EAAE,EACF,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CAClF;aACA,OAAO,EAAE,CAAC;QACb,MAAM,WAAW,GAAiB,EAAE,CAAC;QACrC,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxB,+CAA+C;gBAC/C,WAAW,CAAC,IAAI,CAAC,IAAI,uBAAU,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;QACD,gCAAgC;QAChC,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAnCD,oDAmCC"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IsCappedOperation = void 0;
4
- const error_1 = require("../error");
5
- const operation_1 = require("./operation");
6
- /** @internal */
7
- class IsCappedOperation extends operation_1.AbstractOperation {
8
- constructor(collection, options) {
9
- super(options);
10
- this.options = options;
11
- this.collection = collection;
12
- }
13
- get commandName() {
14
- return 'listCollections';
15
- }
16
- async execute(server, session) {
17
- const coll = this.collection;
18
- const [collection] = await coll.s.db
19
- .listCollections({ name: coll.collectionName }, { ...this.options, nameOnly: false, readPreference: this.readPreference, session })
20
- .toArray();
21
- if (collection == null || collection.options == null) {
22
- throw new error_1.MongoAPIError(`collection ${coll.namespace} not found`);
23
- }
24
- return !!collection.options?.capped;
25
- }
26
- }
27
- exports.IsCappedOperation = IsCappedOperation;
28
- //# sourceMappingURL=is_capped.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is_capped.js","sourceRoot":"","sources":["../../src/operations/is_capped.ts"],"names":[],"mappings":";;;AACA,oCAAyC;AAGzC,2CAAuE;AAEvE,gBAAgB;AAChB,MAAa,iBAAkB,SAAQ,6BAA0B;IAI/D,YAAY,UAAsB,EAAE,OAAyB;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,iBAA0B,CAAC;IACpC,CAAC;IAEQ,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,OAAkC;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7B,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;aACjC,eAAe,CACd,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,EAC7B,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CACnF;aACA,OAAO,EAAE,CAAC;QACb,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;YACrD,MAAM,IAAI,qBAAa,CAAC,cAAc,IAAI,CAAC,SAAS,YAAY,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC;IACtC,CAAC;CACF;AA3BD,8CA2BC"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OptionsOperation = void 0;
4
- const error_1 = require("../error");
5
- const operation_1 = require("./operation");
6
- /** @internal */
7
- class OptionsOperation extends operation_1.AbstractOperation {
8
- constructor(collection, options) {
9
- super(options);
10
- this.options = options;
11
- this.collection = collection;
12
- }
13
- get commandName() {
14
- return 'listCollections';
15
- }
16
- async execute(server, session) {
17
- const coll = this.collection;
18
- const [collection] = await coll.s.db
19
- .listCollections({ name: coll.collectionName }, { ...this.options, nameOnly: false, readPreference: this.readPreference, session })
20
- .toArray();
21
- if (collection == null || collection.options == null) {
22
- throw new error_1.MongoAPIError(`collection ${coll.namespace} not found`);
23
- }
24
- return collection.options;
25
- }
26
- }
27
- exports.OptionsOperation = OptionsOperation;
28
- //# sourceMappingURL=options_operation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options_operation.js","sourceRoot":"","sources":["../../src/operations/options_operation.ts"],"names":[],"mappings":";;;AAEA,oCAAyC;AAGzC,2CAAuE;AAEvE,gBAAgB;AAChB,MAAa,gBAAiB,SAAQ,6BAA2B;IAI/D,YAAY,UAAsB,EAAE,OAAyB;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IACD,IAAa,WAAW;QACtB,OAAO,iBAA0B,CAAC;IACpC,CAAC;IAEQ,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,OAAkC;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7B,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;aACjC,eAAe,CACd,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,EAC7B,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CACnF;aACA,OAAO,EAAE,CAAC;QACb,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;YACrD,MAAM,IAAI,qBAAa,CAAC,cAAc,IAAI,CAAC,SAAS,YAAY,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,UAAU,CAAC,OAAO,CAAC;IAC5B,CAAC;CACF;AA1BD,4CA0BC"}
@@ -1,64 +0,0 @@
1
- import type {
2
- AnyBulkWriteOperation,
3
- BulkOperationBase,
4
- BulkWriteOptions,
5
- BulkWriteResult
6
- } from '../bulk/common';
7
- import type { Collection } from '../collection';
8
- import type { Server } from '../sdam/server';
9
- import type { ClientSession } from '../sessions';
10
- import { type TimeoutContext } from '../timeout';
11
- import { AbstractOperation, Aspect, defineAspects } from './operation';
12
-
13
- /** @internal */
14
- export class BulkWriteOperation extends AbstractOperation<BulkWriteResult> {
15
- override options: BulkWriteOptions;
16
- collection: Collection;
17
- operations: ReadonlyArray<AnyBulkWriteOperation>;
18
-
19
- constructor(
20
- collection: Collection,
21
- operations: ReadonlyArray<AnyBulkWriteOperation>,
22
- options: BulkWriteOptions
23
- ) {
24
- super(options);
25
- this.options = options;
26
- this.collection = collection;
27
- this.operations = operations;
28
- }
29
-
30
- override get commandName() {
31
- return 'bulkWrite' as const;
32
- }
33
-
34
- override async execute(
35
- server: Server,
36
- session: ClientSession | undefined,
37
- timeoutContext: TimeoutContext
38
- ): Promise<BulkWriteResult> {
39
- const coll = this.collection;
40
- const operations = this.operations;
41
- const options = {
42
- ...this.options,
43
- ...this.bsonOptions,
44
- readPreference: this.readPreference,
45
- timeoutContext
46
- };
47
-
48
- // Create the bulk operation
49
- const bulk: BulkOperationBase =
50
- options.ordered === false
51
- ? coll.initializeUnorderedBulkOp(options)
52
- : coll.initializeOrderedBulkOp(options);
53
-
54
- // for each op go through and add to the bulk
55
- for (let i = 0; i < operations.length; i++) {
56
- bulk.raw(operations[i]);
57
- }
58
-
59
- // Execute the bulk
60
- return await bulk.execute({ ...options, session });
61
- }
62
- }
63
-
64
- defineAspects(BulkWriteOperation, [Aspect.WRITE_OPERATION]);
@@ -1,47 +0,0 @@
1
- import { Collection } from '../collection';
2
- import type { Db } from '../db';
3
- import type { Server } from '../sdam/server';
4
- import type { ClientSession } from '../sessions';
5
- import { AbstractOperation, type OperationOptions } from './operation';
6
-
7
- export interface CollectionsOptions extends OperationOptions {
8
- nameOnly?: boolean;
9
- }
10
-
11
- /** @internal */
12
- export class CollectionsOperation extends AbstractOperation<Collection[]> {
13
- override options: CollectionsOptions;
14
- db: Db;
15
-
16
- constructor(db: Db, options: CollectionsOptions) {
17
- super(options);
18
- this.options = options;
19
- this.db = db;
20
- }
21
-
22
- override get commandName() {
23
- return 'listCollections' as const;
24
- }
25
-
26
- override async execute(
27
- server: Server,
28
- session: ClientSession | undefined
29
- ): Promise<Collection[]> {
30
- // Let's get the collection names
31
- const documents = await this.db
32
- .listCollections(
33
- {},
34
- { ...this.options, nameOnly: true, readPreference: this.readPreference, session }
35
- )
36
- .toArray();
37
- const collections: Collection[] = [];
38
- for (const { name } of documents) {
39
- if (!name.includes('$')) {
40
- // Filter collections removing any illegal ones
41
- collections.push(new Collection(this.db, name, this.db.s.options));
42
- }
43
- }
44
- // Return the collection objects
45
- return collections;
46
- }
47
- }
@@ -1,35 +0,0 @@
1
- import type { Collection } from '../collection';
2
- import { MongoAPIError } from '../error';
3
- import type { Server } from '../sdam/server';
4
- import type { ClientSession } from '../sessions';
5
- import { AbstractOperation, type OperationOptions } from './operation';
6
-
7
- /** @internal */
8
- export class IsCappedOperation extends AbstractOperation<boolean> {
9
- override options: OperationOptions;
10
- collection: Collection;
11
-
12
- constructor(collection: Collection, options: OperationOptions) {
13
- super(options);
14
- this.options = options;
15
- this.collection = collection;
16
- }
17
-
18
- override get commandName() {
19
- return 'listCollections' as const;
20
- }
21
-
22
- override async execute(server: Server, session: ClientSession | undefined): Promise<boolean> {
23
- const coll = this.collection;
24
- const [collection] = await coll.s.db
25
- .listCollections(
26
- { name: coll.collectionName },
27
- { ...this.options, nameOnly: false, readPreference: this.readPreference, session }
28
- )
29
- .toArray();
30
- if (collection == null || collection.options == null) {
31
- throw new MongoAPIError(`collection ${coll.namespace} not found`);
32
- }
33
- return !!collection.options?.capped;
34
- }
35
- }
@@ -1,35 +0,0 @@
1
- import type { Document } from '../bson';
2
- import type { Collection } from '../collection';
3
- import { MongoAPIError } from '../error';
4
- import type { Server } from '../sdam/server';
5
- import type { ClientSession } from '../sessions';
6
- import { AbstractOperation, type OperationOptions } from './operation';
7
-
8
- /** @internal */
9
- export class OptionsOperation extends AbstractOperation<Document> {
10
- override options: OperationOptions;
11
- collection: Collection;
12
-
13
- constructor(collection: Collection, options: OperationOptions) {
14
- super(options);
15
- this.options = options;
16
- this.collection = collection;
17
- }
18
- override get commandName() {
19
- return 'listCollections' as const;
20
- }
21
-
22
- override async execute(server: Server, session: ClientSession | undefined): Promise<Document> {
23
- const coll = this.collection;
24
- const [collection] = await coll.s.db
25
- .listCollections(
26
- { name: coll.collectionName },
27
- { ...this.options, nameOnly: false, readPreference: this.readPreference, session }
28
- )
29
- .toArray();
30
- if (collection == null || collection.options == null) {
31
- throw new MongoAPIError(`collection ${coll.namespace} not found`);
32
- }
33
- return collection.options;
34
- }
35
- }