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

Create index also in production mode #3

Open
Clan-Utility opened this issue Mar 14, 2017 · 0 comments
Open

Create index also in production mode #3

Clan-Utility opened this issue Mar 14, 2017 · 0 comments

Comments

@Clan-Utility
Copy link

The current code

if(sails.config.models.migrate !== 'alter' && sails.config.models.migrate !== 'drop') {
      sails.log.verbose('sails mongoat skipping index creation (according to "' + sails.config.models.migrate + '" migration strategy)');
      return cb();
}

skips creating index when sails.config.models.migrate === 'safe'. So what should we do in order to create index in production mode? db-migrate?

Btw, in mongodb doc, it says

If you call multiple createIndex() methods with the same index specification at the same time, only the first operation will succeed, all other operations will have no effect.

Does this mean we can safely call collection.createIndex even in production mode?

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

No branches or pull requests

1 participant