Skip to content

Commit dc993e5

Browse files
committed
Improve flow/grammar in change streams section
1 parent 4b64c2a commit dc993e5

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,16 @@ Mongo.find(:mongo, "users", %{email: %{"$in" => ["[email protected]", "[email protected]
206206

207207
### Change streams
208208

209-
Change streams exist in replica set and cluster systems and tell you about changes to collections.
210-
They work like endless cursors.
211-
The special thing about the change streams is that they are resumable. In the case of a resumable error,
212-
no exception is made, but the cursor is re-scheduled at the last successful location.
213-
The following example will never stop,
214-
so it is a good idea to use a process for change streams.
209+
Change streams are available in replica set and sharded cluster deployments
210+
and tell you about changes to documents in collections. They work like endless
211+
cursors.
212+
213+
The special thing about change streams is that they are resumable: in case of
214+
a resumable error, no exception is propagated to the application, but instead
215+
the cursor is re-scheduled at the last successful location.
216+
217+
The following example will never stop, thus it is a good idea to use a process
218+
for reading from change streams:
215219

216220
```elixir
217221
seeds = ["hostname1.net:27017", "hostname2.net:27017", "hostname3.net:27017"]
@@ -220,7 +224,7 @@ cursor = Mongo.watch_collection(top, "accounts", [], fn doc -> IO.puts "New Tok
220224
cursor |> Enum.each(fn doc -> IO.puts inspect doc end)
221225
```
222226

223-
An example with a spawned process that sends message to the monitor process:
227+
An example with a spawned process that sends messages to the monitor process:
224228

225229
```elixir
226230
def for_ever(top, monitor) do
@@ -231,7 +235,7 @@ end
231235
spawn(fn -> for_ever(top, self()) end)
232236
```
233237

234-
For more information see
238+
For more information see:
235239

236240
* [Mongo.watch_collection](https://hexdocs.pm/mongodb_driver/Mongo.html#watch_collection/5)
237241

0 commit comments

Comments
 (0)