|
1 | 1 | import type { Binary, Document } from '../bson'; |
2 | | -import { AbstractCursor } from '../cursor/abstract_cursor'; |
3 | 2 | import type { Db } from '../db'; |
4 | 3 | import type { Server } from '../sdam/server'; |
5 | 4 | import type { ClientSession } from '../sessions'; |
6 | 5 | import { Callback, maxWireVersion } from '../utils'; |
7 | 6 | import { CommandOperation, CommandOperationOptions } from './command'; |
8 | | -import { executeOperation, ExecutionResult } from './execute_operation'; |
9 | 7 | import { Aspect, defineAspects } from './operation'; |
10 | 8 |
|
11 | 9 | /** @public */ |
@@ -86,47 +84,6 @@ export interface CollectionInfo extends Document { |
86 | 84 | idIndex?: Document; |
87 | 85 | } |
88 | 86 |
|
89 | | -/** @public */ |
90 | | -export class ListCollectionsCursor< |
91 | | - T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo = |
92 | | - | Pick<CollectionInfo, 'name' | 'type'> |
93 | | - | CollectionInfo |
94 | | -> extends AbstractCursor<T> { |
95 | | - parent: Db; |
96 | | - filter: Document; |
97 | | - options?: ListCollectionsOptions; |
98 | | - |
99 | | - constructor(db: Db, filter: Document, options?: ListCollectionsOptions) { |
100 | | - super(db.s.client, db.s.namespace, options); |
101 | | - this.parent = db; |
102 | | - this.filter = filter; |
103 | | - this.options = options; |
104 | | - } |
105 | | - |
106 | | - clone(): ListCollectionsCursor<T> { |
107 | | - return new ListCollectionsCursor(this.parent, this.filter, { |
108 | | - ...this.options, |
109 | | - ...this.cursorOptions |
110 | | - }); |
111 | | - } |
112 | | - |
113 | | - /** @internal */ |
114 | | - _initialize(session: ClientSession | undefined, callback: Callback<ExecutionResult>): void { |
115 | | - const operation = new ListCollectionsOperation(this.parent, this.filter, { |
116 | | - ...this.cursorOptions, |
117 | | - ...this.options, |
118 | | - session |
119 | | - }); |
120 | | - |
121 | | - executeOperation(this.parent.s.client, operation, (err, response) => { |
122 | | - if (err || response == null) return callback(err); |
123 | | - |
124 | | - // TODO: NODE-2882 |
125 | | - callback(undefined, { server: operation.server, session, response }); |
126 | | - }); |
127 | | - } |
128 | | -} |
129 | | - |
130 | 87 | defineAspects(ListCollectionsOperation, [ |
131 | 88 | Aspect.READ_OPERATION, |
132 | 89 | Aspect.RETRYABLE, |
|
0 commit comments