TinyBase logoTinyBase

delIndexDefinition

The delIndexDefinition method removes an existing Index definition.

delIndexDefinition(indexId: Id): Indexes
TypeDescription
indexIdId

The Id of the Index to remove.

returnsIndexes

A reference to the Indexes object.

Example

This example creates a Store, creates an Indexes object, defines a simple Index, and then removes it.

const store = createStore().setTable('pets', {
  fido: {species: 'dog'},
  felix: {species: 'cat'},
  cujo: {species: 'dog'},
});

const indexes = createIndexes(store);
indexes.setIndexDefinition('bySpecies', 'pets', 'species');
console.log(indexes.getIndexIds());
// -> ['bySpecies']

indexes.delIndexDefinition('bySpecies');
console.log(indexes.getIndexIds());
// -> []