feathersjs-ecosystem / feathers-sync

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

Pass a mongoDb Object as config.db #74

Closed Jank1310 closed 6 years ago

Jank1310 commented 6 years ago

I'm trying to use an existing mongodb connection but passing the db object in config won't work.

db - The MongoDB connection string (e.g. mongodb://localhost:27017/events) or database object

Looking at the code (sync.js) it seems there is only connection string handling implemented... One solution would be to just make the mongodb module importable or add database object handling.

Or did I miss something? :/

daffl commented 6 years ago

In the latest version, db does accept a MongoDB connection object like this:

app.configure(sync.mongodb({
  db: existingConnection
  collection: 'events'
}));