sails-hook-mongo-createindex
v1.0.0
Published
Modern sails hook to create indexes in MongoDB
Downloads
6
Readme
sails-hook-mongo-createindex
In a production environment, Sails.js does not create MongoDB index/unique indexes defined in the models, so you would have to do it manually.
This hook solve by using MongoDB's createIndex function to create the indexes.
Getting started
- Install the package
- Make sure you are using the
sails-mongodatabase adapter - Lift the app:
sails lift
Usage
Just add unique or index to your model attribute.
attribute: {
type: "string",
index: true
}or
attribute: {
type: "string",
unique: true
}Contributions
If you find any bugs or want to improve the hook just open an issue or send a pull request, thanks!
