Skip to content

Commit 9d13924

Browse files
committed
chore: updated readme regarding mongodb_ecto, fixed some specs
1 parent 0ef1482 commit 9d13924

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
- support for streaming protocol ([See](https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-monitoring.rst#streaming-protocol))
3131
- support for migration scripts
3232

33+
## mongodb_ecto
34+
35+
The version 1.4.0 supports the [mongodb_ecto](https://github.com/elixir-mongo/mongodb_ecto) package.
36+
A series of changes are required to support the adapter. Some BSON encoders and a missing generic update function were added for the adapter.
37+
Most notably, the `find-then-modify` command functions `find_one_and_update` and `find_one_and_replace` now return appropriate
38+
`FindAndModifyResult` structs that contain additional write information otherwise neglected, which the adapter requires.
39+
40+
After upgrading the driver to version 1.4.0 you need to change the code regarding the results of
41+
* `Mongo.find_one_and_update`
42+
* `Mongo.find_one_and_replace`
43+
3344
## Usage
3445

3546
### Installation
@@ -38,7 +49,7 @@ Add `mongodb_driver` to your mix.exs `deps`.
3849

3950
```elixir
4051
defp deps do
41-
[{:mongodb_driver, "~> 1.0.0"}]
52+
[{:mongodb_driver, "~> 1.4.0"}]
4253
end
4354
```
4455

lib/mongo.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ defmodule Mongo do
474474
BSON.document(),
475475
BSON.document(),
476476
Keyword.t()
477-
) :: result(BSON.document()) | {:ok, nil}
477+
) :: result(Mongo.FindAndModifyResult.t()) | {:ok, nil}
478478
def find_one_and_update(topology_pid, coll, filter, update, opts \\ []) do
479479
_ = modifier_docs(update, :update)
480480

@@ -537,7 +537,7 @@ defmodule Mongo do
537537
BSON.document(),
538538
BSON.document(),
539539
Keyword.t()
540-
) :: result(BSON.document())
540+
) :: result(Mongo.FindAndModifyResult.t())
541541
def find_one_and_replace(topology_pid, coll, filter, replacement, opts \\ []) do
542542
_ = modifier_docs(replacement, :replace)
543543

0 commit comments

Comments
 (0)