Skip to content

MongoIndex

Description

Represents the indexes on a MongoDB collection.

Method Descriptions

list

func list()

Returns all the indexes.

Returns: Array of indexes or error Dictionary

create_one

func create_one(index: Dictionary, options: Dictionary)

Creates an index.

Parameters

  • index: Dictionary representing the 'keys' and 'options' of the new index
  • options: Optional arguments

Returns: The result document or error Dictionary

create_many

func create_many(indexes: Array, options: Dictionary)

Creates mulitple indexes.

Parameters

  • indexes: Array of Dictionary representing the 'keys' and 'options' of the new indexes
  • options: Optional arguments

Returns: The result document or error Dictionary

drop_one

func drop_one(name_or_index, options: Dictionary)

Attempts to drop a single index from the collection its the keys and options.

Parameters

  • name_or_index: Either a String representing the index name or a Dictionary representing the keys and options of the index to drop
  • options: Optional arguments

Returns: True or error Dictionary

drop_all

func drop_all(options: Dictionary)

Drops all indexes in the collection.

Parameters

  • options: Optional arguments

Returns: True or error Dictionary

Back to top