Skip to content

Indexes are not created when declared in Model JSON #103

@ilianaza

Description

@ilianaza

I just want to check whether creating indexes feature has been implemented or not. I followed documentation on http://docs.strongloop.com/display/public/LB/Model+definition+JSON+file#ModeldefinitionJSONfile-Indexes and tried to declare the following index in my model json file:

...
"base": "PersistedModel",
  "indexes": {
    "unique_registration_index": {
      "keys": {
        "playerId": 1,
        "eventId": 1
      },
      "options": {
        "unique": true
      }
    }
  },
...

But when I check MongoDB, I don't see this index being generated.

  1. Has that feature been implemented?
  2. If not, what's the best way for me to restrict uniqueness for combination of fields (like playerId and eventId in my case)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions