Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advice on indexes on 'type' #715

Open
meecect opened this issue Apr 23, 2020 · 2 comments
Open

advice on indexes on 'type' #715

meecect opened this issue Apr 23, 2020 · 2 comments

Comments

@meecect
Copy link

meecect commented Apr 23, 2020

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

@lukejagodzinski
Copy link
Member

@meecect you don't have to do that. Astronomy is already creating index for the type field for you https://github.com/jagi/meteor-astronomy/blob/v2/lib/modules/storage/hooks/apply_definition.js#L100

@meecect
Copy link
Author

meecect commented Apr 25, 2020

thank you, I was kinda assuming that it would, but thought I'd ask anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants