Skip to content
This repository has been archived by the owner on Dec 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #76 from meteor/oplog-filter
Browse files Browse the repository at this point in the history
Allow specifying an oplog filter
  • Loading branch information
nelhage committed Nov 4, 2014
2 parents a3a8214 + 9af3d6f commit e6b0b03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/mosql/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def parse_args
opts.on("--unsafe", "Ignore rows that cause errors on insert") do
@options[:unsafe] = true
end

# eg, --oplog-filter '{"ns": {"$regex": "^somedb[0-9]*\\.collection$"}}'
opts.on("--oplog-filter [filter]", "An additional JSON filter for the oplog query") do |filter|
@options[:oplog_filter] = JSON.parse(filter)
end
end

optparse.parse!(@args)
Expand Down
2 changes: 1 addition & 1 deletion lib/mosql/streamer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def optail
if tail_from.is_a? Time
tail_from = tailer.most_recent_position(tail_from)
end
tailer.tail(:from => tail_from)
tailer.tail(:from => tail_from, :filter => options[:oplog_filter])
until @done
tailer.stream(1000) do |op|
handle_op(op)
Expand Down

0 comments on commit e6b0b03

Please sign in to comment.