Created
January 18, 2016 20:25
-
-
Save anthonycrumley/8af7653fca25c9b11823 to your computer and use it in GitHub Desktop.
Add location to actions based on the network event.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('mongo') | |
def client | |
@client ||= Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'network-dev') | |
end | |
def actions | |
client[:actions] | |
end | |
def network_events | |
client[:networkevents] | |
end | |
actions.find().each do |action| | |
if action[:networkEvent] | |
event = network_events.find(:_id => action[:networkEvent]).first | |
actions.update_one({ :_id => action[:_id] }, { "$set" => { :location => event[:location] }}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment