Class: DbIndex

metamodel.DbIndex(keys, uniqueopt)

Creates a new index instance which is needed to create an
database index.

Constructor

new DbIndex(keys, uniqueopt)

Parameters:
Name Type Attributes Description
keys string | Object.<string, string> | Array.<Object.<string, string>>

The name of the field which will be used
for the index,
an object of an field and index type combination or
an array of objects to create an compound index

unique boolean <optional>

Indicates if the index will be unique

Source:

Members

(static) ASC :string

Type:
  • string
Source:

(static) DESC :string

Type:
  • string
Source:

(static) GEO :string

Type:
  • string
Source:

drop :boolean

Type:
  • boolean
Source:

(readonly) isCompound :boolean

Indicates if this index is a compound index of multiple attributes

Type:
  • boolean
Source:

(readonly) isUnique :boolean

Indicates if this index is an unique index

Type:
  • boolean
Source:

keys :Array.<Object.<string, string>>

An array of mappings from field to index type which are parts of this index/compound index

Type:
  • Array.<Object.<string, string>>
Source:

Methods

(static) fromJSON(json) → {metamodel.DbIndex}

Returns DbIndex Object created from the given JSON

Parameters:
Name Type Description
json json
Source:
Returns:
Type
metamodel.DbIndex

hasKey(name) → {boolean}

Indicates if this index is for the given field or includes it in a compound index

Parameters:
Name Type Description
name string

The name of the field to check for

Source:
Returns:

true if the index contains this field

Type
boolean

toJSON() → {json}

Returns a JSON representation of the Index object

Source:
Returns:

A Json of this Index object

Type
json