MCPcopy
hub / github.com/mongodb/node-mongodb-native / indexes

Method indexes

src/collection.ts:911–925  ·  view source on GitHub ↗
(
    options?: IndexInformationOptions
  )

Source from the content-addressed store, hash-verified

909 ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;
910 indexes(options?: ListIndexesOptions): Promise<IndexDescriptionInfo[]>;
911 async indexes(
912 options?: IndexInformationOptions
913 ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {
914 const indexes: IndexDescriptionInfo[] = await this.listIndexes(options).toArray();
915 const full = options?.full ?? true;
916 if (full) {
917 return indexes;
918 }
919
920 const object: IndexDescriptionCompact = Object.fromEntries(
921 indexes.map(({ name, key }) => [name, Object.entries(key)])
922 );
923
924 return object;
925 }
926
927 /**
928 * Find a document and delete it in one atomic operation. Requires a write lock for the duration of the operation.

Callers 5

indexInformationMethod · 0.95
indexes_test-d.tsFile · 0.80

Calls 3

listIndexesMethod · 0.95
toArrayMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected