Skip to content

Commit 8746a35

Browse files
address Neal's comments
1 parent b0816d8 commit 8746a35

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

src/collection.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,8 @@ export class Collection<TSchema extends Document = Document> {
10421042
* @remarks Only available when used against a 7.0+ Atlas cluster.
10431043
*/
10441044
async createSearchIndex(description: SearchIndexDescription): Promise<string> {
1045-
const indexes = await this.createSearchIndexes([description]);
1046-
return indexes[0];
1045+
const [index] = await this.createSearchIndexes([description]);
1046+
return index;
10471047
}
10481048

10491049
/**
@@ -1057,9 +1057,7 @@ export class Collection<TSchema extends Document = Document> {
10571057
* @remarks Only available when used against a 7.0+ Atlas cluster.
10581058
* @returns
10591059
*/
1060-
async createSearchIndexes(
1061-
descriptions: ReadonlyArray<SearchIndexDescription>
1062-
): Promise<string[]> {
1060+
async createSearchIndexes(descriptions: SearchIndexDescription[]): Promise<string[]> {
10631061
return executeOperation(this.client, new CreateSearchIndexesOperation(this, descriptions));
10641062
}
10651063

src/operations/search_indexes/create.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ export interface SearchIndexDescription {
1818
/** @internal */
1919
export class CreateSearchIndexesOperation extends AbstractOperation<string[]> {
2020
constructor(
21-
private readonly collection: Collection<any>,
21+
private readonly collection: Collection,
2222
private readonly descriptions: ReadonlyArray<SearchIndexDescription>
2323
) {
2424
super();
2525
}
2626

27-
execute(server: Server, session: ClientSession | undefined, callback: Callback<any>): void {
27+
execute(server: Server, session: ClientSession | undefined, callback: Callback<string[]>): void {
2828
const namespace = this.collection.fullNamespace;
2929
const command = {
3030
createSearchIndexes: namespace.collection,

src/operations/search_indexes/drop.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import type { ClientSession } from '../../sessions';
66
import type { Callback } from '../../utils';
77
import { AbstractOperation } from '../operation';
88

9+
/** @internal */
910
export class DropSearchIndexOperation extends AbstractOperation<void> {
10-
/** @internal */
11-
constructor(private readonly collection: Collection<any>, private readonly name: string) {
11+
constructor(private readonly collection: Collection, private readonly name: string) {
1212
super();
1313
}
1414

src/operations/search_indexes/list.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { Document } from 'bson';
2-
31
import type { Collection } from '../../collection';
42
import { AggregationCursor } from '../../cursor/aggregation_cursor';
53
import type { AggregateOptions } from '../aggregate';
@@ -10,8 +8,8 @@ export type ListSearchIndexesOptions = AggregateOptions;
108
/** @public */
119
export class ListSearchIndexesCursor extends AggregationCursor<{ name: string }> {
1210
/** @internal */
13-
static create<T extends Document>(
14-
{ fullNamespace: ns, client }: Collection<T>,
11+
static create(
12+
{ fullNamespace: ns, client }: Collection,
1513
name: string | null,
1614
options: ListSearchIndexesOptions = {}
1715
): ListSearchIndexesCursor {

src/operations/search_indexes/update.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import type { ClientSession } from '../../sessions';
66
import type { Callback } from '../../utils';
77
import { AbstractOperation } from '../operation';
88

9+
/** @internal */
910
export class UpdateSearchIndexOperation extends AbstractOperation<void> {
1011
constructor(
11-
private readonly collection: Collection<any>,
12+
private readonly collection: Collection,
1213
private readonly name: string,
1314
private readonly definition: Document
1415
) {

0 commit comments

Comments
 (0)