Skip to content

Commit 5026ad6

Browse files
authored
Docs and changelog for 2.0.0 (#194)
* changelog for 2.0.0 * migration guide * revisions
1 parent dfd21c5 commit 5026ad6

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 2.0.0
9+
10+
* Change underlying driver from [`mongodb`](https://github.com/elixir-mongo/mongodb) to [`mongodb_driver`](https://github.com/zookzook/elixir-mongodb-driver) 1.4.0
11+
* Remove config options `pool`, `pool_overflow`, and `pool_timeout`
12+
* Add support for MongoDB 6.0 and 7.0
13+
* Add support for loading & dumping nil binaries and dumping nil dates
14+
15+
### Possible breaking changes
16+
17+
Calls to the Ecto adapter itself should not require any changes. However, if you make direct calls to the `Mongo` driver, you will need to update some of them to account for the `mongodb` -> `mongodb_driver` upgrade. See [Migrating to 2.0](./README.md#migrating-to-20) in the Readme.
18+
819
## 1.1.2
920
* Add support for loading nil dates
1021

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,33 @@ Additionally special values are translated as follows:
122122

123123
The adapter and the driver are tested against most recent versions from 5.0, 6.0, and 7.0.
124124

125+
## Migrating to 2.0
126+
127+
Release 2.0 changes the underlying driver from [`mongodb`](https://github.com/elixir-mongo/mongodb) to [`mongodb_driver`](https://github.com/zookzook/elixir-mongodb-driver) 1.4.0. Calls to the Ecto adapter itself should not require any changes. Some config options are no longer used and can be simply deleted: `pool`, `pool_overflow`, `pool_timeout`.
128+
129+
If you make direct calls to the `Mongo` driver, you will need to update some of them to account for the `mongodb` -> `mongodb_driver` upgrade. Also, remember to replace `:mongodb` with `{:mongodb_driver, "~> 1.4.0"}` in your `mix.exs`. The known updates are:
130+
1. `Mongo` functions no longer accept a `pool` option or `MyApp.Repo.Pool` module argument. Instead, a pool PID is expected:
131+
```elixir
132+
# Old driver call
133+
Mongo.find(MyApp.Repo.Pool, "my_coll", %{"id": id}, projection: %{"field": 1}, pool: db_pool())
134+
135+
# New driver call
136+
Mongo.find(MyApp.Repo.pool(), "my_coll", %{"id": id}, projection: %{"field": 1})
137+
138+
# repo.ex
139+
# Provided the following function is defined in MyApp.Repo:
140+
defmodule MyApp.Repo do
141+
use Ecto.Repo, otp_app: :my_app, adapter: Mongo.Ecto
142+
143+
def pool() do
144+
Ecto.Adapter.lookup_meta(__MODULE__).pid
145+
end
146+
end
147+
```
148+
2. [`Mongo.command`](https://hexdocs.pm/mongodb_driver/1.4.1/Mongo.html#command/3) requires a keyword list instead of a document. E.g., instead of `Mongo.command(MyApp.Repo.pool(), %{listCollections: 1}, opts)`, do `Mongo.command(MyApp.Repo.pool(), [listCollections: 1], opts)`.
149+
3. `Mongo.ReadPreferences.defaults` is renamed to `Mongo.ReadPreference.merge_defaults`.
150+
4. When passing a `hint` to `Mongo.find_one` etc., if the hinted index does not exist, an error is now returned.
151+
125152
## Contributing
126153

127154
To contribute you need to compile `Mongo.Ecto` from source and test it:

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Mongo.Ecto.Mixfile do
22
use Mix.Project
33

44
@source_url "https://github.com/elixir-mongo/mongodb_ecto"
5-
@version "1.1.2"
5+
@version "2.0.0"
66

77
def project do
88
[

0 commit comments

Comments
 (0)