Skip to content

Commit c7946de

Browse files
committed
updated readme and changelog
1 parent 2f498df commit c7946de

File tree

3 files changed

+44
-16
lines changed

3 files changed

+44
-16
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v0.5.4
2+
3+
* Enhancements
4+
* The driver provides now client metadata
5+
16
## v0.5.3
27

38
* Enhancements

README.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,22 @@
88
This is an alternative development from the [original](https://github.com/ankhers/mongodb), which was the starting point
99
and already contained very nice code.
1010

11-
I have made a number of changes to understand how the driver works. For example, I reduced cursor modules to just one cursor and
12-
replaced some op code calls with command calls.
13-
14-
This is currently under development and there is no version management yet. The main goal is to simplify the API and
15-
to implement the current requirements for the driver.
16-
17-
[Documentation](https://hexdocs.pm/mongodb_driver/readme.html)
11+
The [Documentation](https://hexdocs.pm/mongodb_driver/readme.html) is online, but currently not up to date.
12+
This will be done as soon as possible. In the meantime, look in the source code. Especially
13+
for the individual options.
1814

1915
## Motivation
2016

21-
* [ ] Refactoring old code into new
17+
* [x] I have made a number of changes to understand how the driver works. For example, I reduced cursor modules to just one cursor and
18+
replaced some op code calls with command calls.
2219
* [x] Simplify code: remove raw_find (raw_find called from cursors, raw_find called with "$cmd"), so raw_find is more calling a command than a find query.
2320
* [x] Better support for new MongoDB version, for example the ability to use views
24-
* [x] Upgrade to ([DBConnection 2.x](https://github.com/elixir-ecto/db_connection))
21+
* [x] Upgraded to ([DBConnection 2.x](https://github.com/elixir-ecto/db_connection))
2522
* [x] Removed depreacated op codes ([See](https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#request-opcodes))
26-
* [x] Support for SCRAM-SHA-256 (MongoDB 4.x)
27-
* [x] Support for change streaming api ([See](https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst))
28-
* [x] Add `op_msg` support ([See](https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-msg))
29-
* [ ] driver sessions ([See](https://github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst))
30-
* [ ] driver transactions ([See](https://github.com/mongodb/specifications/blob/master/source/transactions/transactions.rst))
23+
* [x] Added `op_msg` support ([See](https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-msg))
24+
* [ ] Add support for driver sessions ([See](https://github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst))
25+
* [ ] Add support driver transactions ([See](https://github.com/mongodb/specifications/blob/master/source/transactions/transactions.rst))
26+
* [ ] Add support for `op_compressed` ([See](https://github.com/mongodb/specifications/blob/master/source/compression/OP_COMPRESSED.rst))
3127
* [ ] Because the driver is used in production environments, quick adjustments are necessary.
3228

3329
## Features
@@ -40,6 +36,8 @@ to implement the current requirements for the driver.
4036
* Safe (by default) and unsafe writes
4137
* Aggregation pipeline
4238
* Replica sets
39+
* Support for SCRAM-SHA-256 (MongoDB 4.x)
40+
* Support for change streams api ([See](https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst))
4341

4442

4543
## Data representation
@@ -77,7 +75,7 @@ def application do
7775
end
7876

7977
defp deps do
80-
[{:mongodb_driver, "~> 0.5.0"}]
78+
[{:mongodb_driver, "~> 0.5.3"}]
8179
end
8280
```
8381

@@ -166,7 +164,32 @@ you'll want to add this cipher to your `ssl_opts`:
166164
]
167165
)
168166
```
167+
### Change streams
168+
169+
Change streams exist in replica set and cluster systems and tell you about changes to collections.
170+
They work like endless cursors.
171+
The special thing about the change streams is that they are resumable. In the case of a resumable error,
172+
no exception is made, but the cursor is re-scheduled at the last successful location.
173+
The following example will never stop,
174+
so it is a good idea to use a process for change streams.
175+
176+
```
177+
seeds = ["hostname1.net:27017", "hostname2.net:27017", "hostname3.net:27017"]
178+
{:ok, top} = Mongo.start_link(database: "my-db", seeds: seeds, appname: "getting rich")
179+
cursor = Mongo.watch_collection(top, "accounts", [], fn doc -> IO.puts "New Token #{inspect doc}" end, max_time: 2_000 )
180+
cursor |> Enum.each(fn doc -> IO.puts inspect doc end)
181+
```
182+
183+
An example with a spawned process that sends message to the monitor process:
169184

185+
```
186+
def for_ever(top, monitor) do
187+
cursor = Mongo.watch_collection(top, "users", [], fn doc -> send(monitor, {:token, doc}) end)
188+
cursor |> Enum.each(fn doc -> send(monitor, {:change, doc}) end)
189+
end
190+
191+
spawn(fn -> for_ever(top, self()) end)
192+
```
170193
### Examples
171194

172195
Using `$and`

lib/mongo/mongo_db_connection.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ defmodule Mongo.MongoDBConnection do
134134
end
135135

136136
defp hand_shake(opts, state) do
137-
wire_version(state, driver(opts[:appname] || "My killer app"))
137+
wire_version(state, driver(opts[:appyname] || "My killer app"))
138138
end
139139

140140
defp driver(appname) do

0 commit comments

Comments
 (0)