Skip to content

Commit 1e1100f

Browse files
authored
Merge pull request #66 from p-mongo/readme
Miscellaneous readme improvements
2 parents 4b64c2a + 23d8522 commit 1e1100f

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# An alternative Mongodb driver for Elixir
1+
# An Alternative Elixir Driver for MongoDB
22
[![Build Status](https://travis-ci.org/zookzook/elixir-mongodb-driver.svg?branch=master)](https://travis-ci.org/zookzook/elixir-mongodb-driver)
33
[![Coverage Status](https://coveralls.io/repos/github/zookzook/elixir-mongodb-driver/badge.svg?branch=master)](https://coveralls.io/github/zookzook/elixir-mongodb-driver?branch=master)
44
[![Hex.pm](https://img.shields.io/hexpm/v/mongodb_driver.svg)](https://hex.pm/packages/mongodb_driver)
@@ -24,7 +24,7 @@
2424
* support for retryable reads ([See](https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.rst))
2525
* support for retryable writes ([See](https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.rst))
2626

27-
## Data representation
27+
## Data Representation
2828

2929
BSON Elixir
3030
---------- ------
@@ -50,7 +50,7 @@ BSON symbols can only be decoded.
5050

5151
## Usage
5252

53-
### Installation:
53+
### Installation
5454

5555
Add `mongodb_driver` to your mix.exs `deps`.
5656

@@ -62,7 +62,7 @@ end
6262

6363
Then run `mix deps.get` to fetch dependencies.
6464

65-
### Simple connection to MongoDB
65+
### Simple Connection to MongoDB
6666

6767
```elixir
6868
# Starts an unpooled connection
@@ -112,7 +112,7 @@ Failing operations return a `{:error, error}` tuple where `error` is a
112112
}}
113113
```
114114

115-
### Connection pooling
115+
### Connection Pooling
116116
The driver supports pooling by DBConnection (2.x). By default `mongodb_driver` will start a single
117117
connection, but it also supports pooling with the `:pool_size` option. For 3 connections add the `pool_size: 3` option to `Mongo.start_link` and to all
118118
function calls in `Mongo` using the pool:
@@ -158,7 +158,7 @@ of a `:hostname` and `:port` pair.
158158
This will allow for scenarios where the first `"hostname1.net:27017"` is unreachable for any reason
159159
and will automatically try to connect to each of the following entries in the list to connect to the cluster.
160160

161-
### Auth mechanisms
161+
### Auth Mechanisms
162162

163163
For versions of Mongo 3.0 and greater, the auth mechanism defaults to SCRAM.
164164
If you'd like to use [MONGODB-X509](https://docs.mongodb.com/manual/tutorial/configure-x509-client-authentication/#authenticate-with-a-x-509-certificate)
@@ -168,7 +168,7 @@ authentication, you can specify that as a `start_link` option.
168168
{:ok, pid} = Mongo.start_link(database: "test", auth_mechanism: :x509)
169169
```
170170

171-
### AWS, TLS and Erlang SSL ciphers
171+
### AWS, TLS and Erlang SSL Ciphers
172172

173173
Some MongoDB cloud providers (notably AWS) require a particular TLS cipher that isn't enabled
174174
by default in the Erlang SSL module. In order to connect to these services,
@@ -204,14 +204,18 @@ Using `$in`
204204
Mongo.find(:mongo, "users", %{email: %{"$in" => ["my@email.com", "other@email.com"]}})
205205
```
206206

207-
### Change streams
207+
### 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

@@ -252,7 +256,7 @@ Mongo.insert_many(top, "users", [
252256
])
253257
```
254258

255-
### Bulk writes
259+
### Bulk Writes
256260

257261
The motivation for bulk writes lies in the possibility of optimization, the same operations
258262
to group. Here, a distinction is made between disordered and ordered bulk writes.
@@ -316,10 +320,8 @@ and have a look at the test units as well.
316320

317321
### GridFS
318322

319-
The driver supports the GridFS specifications. You create a `Mongo.GridFs.Bucket` struct and with this struct you can
320-
upload and download files.
321-
322-
### Example
323+
The driver supports the GridFS specifications. You create a `Mongo.GridFs.Bucket`
324+
struct and with this struct you can upload and download files. For example:
323325

324326
```elixir
325327
bucket = Bucket.new(top)
@@ -405,8 +407,6 @@ iex> Mongo.find_one(conn, "test", %{})
405407
The `travis.yml` file uses only the latest MongoDB. It creates a replica set of three nodes and disables the SSL test case. If you want to
406408
run the test cases against other MongoDB deployments or older versions, you can use the [mtools](https://github.com/rueckstiess/mtools) for deployment and run the test cases locally:
407409

408-
### Example
409-
410410
```bash
411411
pyenv global 3.6
412412
pip3 install --upgrade pip
@@ -418,11 +418,11 @@ mix test --exclude ssl --exclude socket
418418

419419
The SSL test suite is disabled by default.
420420

421-
### Enable the SSL tests
421+
### Enable the SSL Tests
422422

423423
`mix test --exclude ssl`
424424

425-
### Enable SSL on your Mongo server
425+
### Enable SSL on Your MongoDB Server
426426

427427
```bash
428428
$ openssl req -newkey rsa:2048 -new -x509 -days 365 -nodes -out mongodb-cert.crt -keyout mongodb-cert.key
@@ -433,21 +433,21 @@ $ mongod --sslMode allowSSL --sslPEMKeyFile /path/to/mongodb.pem
433433
* For `--sslMode` you can use one of `allowSSL` or `preferSSL`
434434
* You can enable any other options you want when starting `mongod`
435435

436-
## More examples
436+
## More Examples
437437

438438
There are some basic examples in the `example` folder. But if you want to see the driver in action
439439
take a look at [Vega](https://github.com/zookzook/vega), especially the [Board.ex](https://github.com/zookzook/vega/blob/master/lib/vega/board.ex) module for using the transaction api together with
440440
bulk operations.
441441

442-
## Special thanks
442+
## Special Thanks
443443

444444
Special thanks to [JetBrains](https://www.jetbrains.com/?from=elixir-mongodb-driver) for providing a free JetBrains Open Source license for their complete toolbox.
445445

446446
The [Documentation](https://hexdocs.pm/mongodb_driver/readme.html) is online, but currently not up to date.
447447
This will be done as soon as possible. In the meantime, look in the source code. Especially
448448
for the individual options.
449449

450-
This driver is based on [original](https://github.com/ankhers/mongodb).
450+
This driver is based on the [original Elixir driver for MongoDB](https://github.com/ankhers/mongodb).
451451

452452
## License
453453

0 commit comments

Comments
 (0)