Thanks for this. But what do you need to do to get it to run?
I’m on Elixir 1.11.1. My mix.exs has
defp deps do
[
{:gettext, "~> 0.11"},
{:mongodb_driver, "~> 0.7.0"},
{:mongodb, "~> 0.5.1"}
]
end
and my app is start.exs:
#! /usr/bin/env elixir
defmodule MongoExample do
def example1() do
{:ok, conn} = Mongo.start_link(url: "mongodb://localhost:27017/db-1")
cursor = Mongo.find(conn, "test-collection", %{})
cursor
|> Enum.to_list()
|> IO.inspect
end
end
MongoExample.example1()
Mongo is running, but when I run the app, I just get “Mongo.start_link/1 is undefined (module Mongo is not available)”