Elixir + Mongo Unit test case

I was using elixir + mongo combo. How can we achieve unit test cases in that?. In postgres all unit test cases are work individually. Once the test case was finished. Inserted data get reverted(In postgres). How I can achive the same in mongo elixir?

If mongo supports transactions you can also wrap your test case in a transaction that gets reverted on test exit. Check out Ecto.Adapters.SQL.Sandbox — Ecto SQL v3.7.0 for how ecto does it. You might need to use a Repo-like pattern to make switch to sandbox transparent. Or you can accept a transaction reference in all mongo related functions.

1 Like

Thanks @ruslandoga I will try it

@scottmessinger We don’t have transaction support in mongodb for now right(That session module inside the mongo folder)? Using directly from git master is safe?