Last active
August 29, 2015 14:11
-
-
Save jontonsoup/2554e5dc4cd25c14823f to your computer and use it in GitHub Desktop.
Mongo Service
This file contains hidden or 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
21:40:59.077 [info] Started MongoService | |
21:40:59.077 [info] Started populating Urls | |
=INFO REPORT==== 22-Dec-2014::21:41:00 === | |
application: logger | |
exited: stopped | |
type: temporary | |
=INFO REPORT==== 22-Dec-2014::21:41:00 === | |
application: httpoison | |
exited: stopped | |
type: temporary | |
=INFO REPORT==== 22-Dec-2014::21:41:00 === | |
application: hackney | |
exited: stopped | |
type: temporary | |
=INFO REPORT==== 22-Dec-2014::21:41:00 === | |
application: idna | |
exited: stopped | |
type: temporary | |
** (Mix) Could not start application jobboard: exited in: JB.start(:normal, []) | |
** (EXIT) exited in: GenServer.call(:mongo_service, {:get, #Function<2.24609682/1 in MongoService.insert/2>}, 5000) | |
** (EXIT) no process |
This file contains hidden or 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
def start_link do | |
{:ok, pid} = Agent.start_link(fn -> | |
mongo = Mongo.connect! | |
db = mongo |> Mongo.db("simply_hired_urls") | |
collection = db |> Mongo.Db.collection("urls") | |
end, | |
name: :mongo_service) | |
Logger.info "Started MongoService" | |
{:ok, pid} | |
end | |
def insert(query, object) do | |
collection = Agent.get(:mongo_service, fn connection -> connection end) | |
Mongo.Collection.update(collection, query, object, true) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My error is:
** (Mix) Could not start application jobboard: exited in: JB.start(:normal, [])
** (EXIT) exited in: GenServer.call(:mongo_service, {:get, #Function<2.24609682/1 in MongoService.insert/2>}, 5000)
** (EXIT) no process