From 0c1b5c4a500659f2050a5b559bd0c8495b049d7c Mon Sep 17 00:00:00 2001 From: zookzook Date: Fri, 27 May 2022 14:16:48 +0200 Subject: [PATCH] add backward compatible for Elixir < 1.13 --- CHANGELOG.md | 4 ++++ lib/mongo.ex | 3 ++- mix.exs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc64b5dc..fc0f1bff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.9.1 (2022-05-27) +* Bugfix + * add backward compatible for Elixir < 1.13 (thanks to ja-jimenez) + ## 0.9.0 (2022-05-21) * Enhancements * add colored log output diff --git a/lib/mongo.ex b/lib/mongo.ex index 7571c70e..6f1d5af6 100644 --- a/lib/mongo.ex +++ b/lib/mongo.ex @@ -1824,7 +1824,8 @@ defmodule Mongo do end defp to_iodata(doc) do - opts = Inspect.Opts.new([]) + default_inspect_fun = :persistent_term.get({Inspect.Opts, :inspect_fun}, &Inspect.inspect/2) + opts = %Inspect.Opts{inspect_fun: default_inspect_fun} doc = doc diff --git a/mix.exs b/mix.exs index e217de1c..226670c2 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule Mongodb.Mixfile do use Mix.Project @source_url "https://github.com/zookzook/elixir-mongodb-driver" - @version "0.9.0" + @version "0.9.1" def project() do [