Skip to content

advice on indexes on 'type' #715

@meecect

Description

@meecect

I have something like:

export const Entity = Class.create({
  name: 'Entity',
  collection: Entities,
  typeField: 'type',
  fields: {
    uuid: {
      type: String,
      optional: true,
    },
    published: {
      type: Boolean,
      default: true,
    },

and then numerous subclasses of that.

I was thinking of adding an index on type so I did like this:

export const Entity = Class.create({
  name: 'Entity',
  collection: Entities,
  typeField: 'type',
  fields: {
    type: {
      type: String,
      index: "String"
    },
    uuid: {
      type: String,
      optional: true,
    },

Does that sound reasonable? Is there any issue defining the field (and the index) like that even though I already specified the 'typeField' parameter?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions