Configures and starts local or distributed MongoDB clusters. This library is intended to be used for tests, and is not production-ready.
Features
- Configure replica sets
- Starts and manages
mongod
processes through Docker: no Erlang ports - Automatically reconfigure and reuse existing Mongo containers
-
Configure sharded clusters
Requirements
- MongoDB 2.4 or later installed on the box in which Mongoman runs (including for tests)
Add mongoman
to your list of dependencies in mix.exs
:
def deps do
[{:mongoman, "~> 0.3.6"}]
end
Start a replica set named "my_repl_set"
with 9 members:
alias Mongoman.{ReplicaSet, ReplicaSetConfig}
{:ok, pid} = ReplicaSet.start_link(ReplicaSetConfig.make("my_repl_set", 9))