monq
monq copied to clipboard
wish: document the name of the collection(s) used by 'monq'
I'm considering adding a 'monq' job queue to an existing database. It would be helpful if the names of any collections used were documented so it would be clear if there was a conflict.
All jobs will be saved to the jobs collection by default. I'm realizing there's actually not a very good way to configure that though. The way it's setup currently, you'd need to specify the collection for each queue:
var foo = client.queue('foo', { collection: 'myjobs' });
var bar = client.queue('bar', { collection: 'myjobs' });
And likely again for the workers:
var worker = client.worker([
client.queue('foo', { collection: 'myjobs' }),
client.queue('bar', { collection: 'myjobs' })
]);
This doesn't really make a lot of sense. Perhaps we should allow the default collection to be changed globally for the whole client connection? What do you think?
var client = monq('mongodb://localhost:27017/monq_example', { collection: 'myjobs' });