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

Method createIndexes

src/collection.ts:684–697  ·  view source on GitHub ↗

* Creates multiple indexes in the collection, this method is only supported for * MongoDB 2.6 or higher. Earlier version of MongoDB will throw a command not supported * error. * * **Note**: Unlike {@link Collection#createIndex| createIndex}, this function takes in raw index specification

(
    indexSpecs: IndexDescription[],
    options?: CreateIndexesOptions
  )

Source from the content-addressed store, hash-verified

682 * ```
683 */
684 async createIndexes(
685 indexSpecs: IndexDescription[],
686 options?: CreateIndexesOptions
687 ): Promise<string[]> {
688 return await executeOperation(
689 this.client,
690 CreateIndexesOperation.fromIndexDescriptionArray(
691 this,
692 this.collectionName,
693 indexSpecs,
694 resolveOptions(this, { ...options, maxTimeMS: undefined })
695 )
696 );
697 }
698
699 /**
700 * Drops an index from this collection.

Callers 6

collations.test.jsFile · 0.80
bulk.test.tsFile · 0.80

Calls 3

executeOperationFunction · 0.90
resolveOptionsFunction · 0.90

Tested by

no test coverage detected