diff --git a/README.md b/README.md index 8fbdc623..051ee5ae 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,17 @@ - support for streaming protocol ([See](https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-monitoring.rst#streaming-protocol)) - support for migration scripts +## mongodb_ecto + +The version 1.4.0 supports the [mongodb_ecto](https://github.com/elixir-mongo/mongodb_ecto) package. +A series of changes are required to support the adapter. Some BSON encoders and a missing generic update function were added for the adapter. +Most notably, the `find-then-modify` command functions `find_one_and_update` and `find_one_and_replace` now return appropriate +`FindAndModifyResult` structs that contain additional write information otherwise neglected, which the adapter requires. + +After upgrading the driver to version 1.4.0 you need to change the code regarding the results of +* `Mongo.find_one_and_update` +* `Mongo.find_one_and_replace` + ## Usage ### Installation @@ -38,7 +49,7 @@ Add `mongodb_driver` to your mix.exs `deps`. ```elixir defp deps do - [{:mongodb_driver, "~> 1.0.0"}] + [{:mongodb_driver, "~> 1.4.0"}] end ``` diff --git a/lib/mongo.ex b/lib/mongo.ex index ceb2c0ec..08aa61b4 100644 --- a/lib/mongo.ex +++ b/lib/mongo.ex @@ -474,7 +474,7 @@ defmodule Mongo do BSON.document(), BSON.document(), Keyword.t() - ) :: result(BSON.document()) | {:ok, nil} + ) :: result(Mongo.FindAndModifyResult.t()) | {:ok, nil} def find_one_and_update(topology_pid, coll, filter, update, opts \\ []) do _ = modifier_docs(update, :update) @@ -537,7 +537,7 @@ defmodule Mongo do BSON.document(), BSON.document(), Keyword.t() - ) :: result(BSON.document()) + ) :: result(Mongo.FindAndModifyResult.t()) def find_one_and_replace(topology_pid, coll, filter, replacement, opts \\ []) do _ = modifier_docs(replacement, :replace)