Skip to content

Commit d45cdbc

Browse files
remove 'IndexesOperation'
1 parent 53ff294 commit d45cdbc

File tree

3 files changed

+1
-38
lines changed

3 files changed

+1
-38
lines changed

src/collection.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import {
5555
type DropIndexesOptions,
5656
DropIndexOperation,
5757
type IndexDescription,
58-
IndexesOperation,
5958
IndexExistsOperation,
6059
IndexInformationOperation,
6160
type IndexSpecification,
@@ -805,10 +804,7 @@ export class Collection<TSchema extends Document = Document> {
805804
* @param options - Optional settings for the command
806805
*/
807806
async indexes(options?: IndexInformationOptions): Promise<Document[]> {
808-
return executeOperation(
809-
this.client,
810-
new IndexesOperation(this as TODO_NODE_3286, resolveOptions(this, options))
811-
);
807+
return this.listIndexes(options).toArray();
812808
}
813809

814810
/**

src/operations/indexes.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -175,34 +175,6 @@ function makeIndexSpec(
175175
return { ...options, key };
176176
}
177177

178-
/** @internal */
179-
export class IndexesOperation extends AbstractOperation<Document[]> {
180-
override options: IndexInformationOptions;
181-
collection: Collection;
182-
183-
constructor(collection: Collection, options: IndexInformationOptions) {
184-
super(options);
185-
this.options = options;
186-
this.collection = collection;
187-
}
188-
189-
override get commandName() {
190-
return 'listIndexes' as const;
191-
}
192-
193-
override async execute(_server: Server, session: ClientSession | undefined): Promise<Document[]> {
194-
const coll = this.collection;
195-
const options = this.options;
196-
197-
return indexInformation(coll.s.db, coll.collectionName, {
198-
full: true,
199-
...options,
200-
readPreference: this.readPreference,
201-
session
202-
});
203-
}
204-
}
205-
206178
/** @internal */
207179
export class CreateIndexesOperation extends CommandOperation<string[]> {
208180
override options: CreateIndexesOptions;

test/integration/crud/abstract_operation.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ describe('abstract operation', async function () {
141141
subclassType: mongodb.GetMoreOperation,
142142
correctCommandName: 'getMore'
143143
},
144-
{
145-
subclassCreator: () => new mongodb.IndexesOperation(collection, {}),
146-
subclassType: mongodb.IndexesOperation,
147-
correctCommandName: 'listIndexes'
148-
},
149144
{
150145
subclassCreator: () =>
151146
mongodb.CreateIndexesOperation.fromIndexDescriptionArray(db, 'bar', [{ key: { a: 1 } }]),

0 commit comments

Comments
 (0)