seneca-mongo-store icon indicating copy to clipboard operation
seneca-mongo-store copied to clipboard

Mongo Indexes

Open sean-hill opened this issue 8 years ago • 3 comments

Hey, I was curious what the best practice would be to setup indexes on my mongo DB database while using this plugin with my Seneca services. For example setting an index for an email address field for a user document. Each group (roles) of related services are in a separate project so I can deploy to different instances. Thanks!

sean-hill avatar Jun 26 '16 17:06 sean-hill

Any help with this?

mnovosel2 avatar Aug 27 '16 10:08 mnovosel2

I set my indexes up in the plugin init action.

seneca.add({
  init: 'PluginName'
}, function(msg, done) {
  const entity = seneca.make();
  
  entity.native$(function (err, db) {
    db.ensureIndex(...);
  })
})

MikeLindenau avatar Aug 27 '17 19:08 MikeLindenau

Database configuration should be managed separately from Seneca via Kubernetes, Pulumi, Ansible, etc

rjrodger avatar May 25 '21 18:05 rjrodger