cayasso / mongo-oplog

Watch mongodb oplog in a simple way
380 stars 91 forks source link

QUESTION: Multiple `ns` #64

Closed pbr0ck3r closed 6 years ago

pbr0ck3r commented 6 years ago

Is there a way to have multiple DB and tables in one statement?

I am trying the following... mongoOplog('mongodb://127.0.0.1:27017/local', {ns: 'test.users', ns: 'test.roles', ns:'test.companies'})

I get events (insert, delete, update) to fire oncompanies but for some reason roles, users will not fire.

Is there another way I should be monitoring multiple tables in the database?

vinespring commented 6 years ago

@pbr0ck3r Looks like it builds a $regex query for the ns field. (stream.js)

You should be able to do ns: 'test.roles|test.companies|test.users'.

pbr0ck3r commented 6 years ago

@vinespring... that does indeed work! Thanks so much!

cayasso commented 6 years ago

Closing since solution was pointed out.