senecajs / seneca-mongo-store

Node.js Seneca data storage plugin for MongoDB
MIT License
35 stars 42 forks source link

Mongo Indexes #40

Open sean-hill opened 8 years ago

sean-hill commented 8 years ago

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!

mnovosel2 commented 8 years ago

Any help with this?

MikeLindenau commented 7 years ago

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(...);
  })
})
rjrodger commented 3 years ago

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