feathersjs-ecosystem / feathers-sync

Synchronize service events between Feathers application instances
MIT License
222 stars 41 forks source link

Mubsub config option fix #59

Closed thebarndog closed 7 years ago

thebarndog commented 7 years ago

I noticed a bug with mongodb using this application setup:

app
  .configure(configuration(path.join(__dirname, '..')))
  .use(compress())
  .options('*', cors())
  .use(cors())
  .use(bodyParser.json())
  .use(bodyParser.urlencoded({ extended: true }))
  .configure(hooks())
  .configure(rest())
  .configure(socketio())
  .configure(sync({
    db: 'mongodb://localhost:27017/sync',
    collection: 'events'
  }))
  .configure(services)
  .configure(jwt())
  .configure(oauth2({
    name: 'facebook-token',
    Strategy: FacebookTokenStrategy
  }))
  .configure(oauth1({
    name: 'twitter-token',
    Strategy: TwitterTokenStrategy
  }))
  .configure(middleware);

On startup, an error was being thrown:

MongoError: The field 'db' is not a valid collection option. Options: { db: "mongodb://localhost:27017/sync", collection: "events", capped: true, size: 5242880 }

The error stems from mubsub, which only takes four config options passed to client.channel: size, max, retryInterval, and recreate. The solution is simple, delete config.db and config.collection after using them.

ekryski commented 7 years ago

:shipit: