sails-hook-mongo-auto-index
v0.1.3
Published
Sails Hook to auto create mongo indexes
Downloads
8
Readme
sails-hook-mongo-auto-index
In production, sails.js does not create mongo indexes/unique indexes defined on the models, so manual index creation is necessary (https://github.com/balderdashy/sails-mongo/issues/290).
This hook tries to solve this issue by using mongo's ensureIndex function to create the indexes in all environments.
The indexes are automatically created based on the attributes found on your waterline models :
name: {
type: 'string',
index: true
}
Or
name: {
type: 'string',
unique: true
}