You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* support for retryable reads ([See](https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.rst))
25
25
* support for retryable writes ([See](https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.rst))
26
26
27
-
## Data representation
27
+
## Data Representation
28
28
29
29
BSON Elixir
30
30
---------- ------
@@ -50,19 +50,19 @@ BSON symbols can only be decoded.
50
50
51
51
## Usage
52
52
53
-
### Installation:
53
+
### Installation
54
54
55
55
Add `mongodb_driver` to your mix.exs `deps`.
56
56
57
57
```elixir
58
58
defpdepsdo
59
-
[{:mongodb_driver, "~> 0.6"}]
59
+
[{:mongodb_driver, "~> 0.7"}]
60
60
end
61
61
```
62
62
63
63
Then run `mix deps.get` to fetch dependencies.
64
64
65
-
### Simple connection to MongoDB
65
+
### Simple Connection to MongoDB
66
66
67
67
```elixir
68
68
# Starts an unpooled connection
@@ -112,7 +112,7 @@ Failing operations return a `{:error, error}` tuple where `error` is a
112
112
}}
113
113
```
114
114
115
-
### Connection pooling
115
+
### Connection Pooling
116
116
The driver supports pooling by DBConnection (2.x). By default `mongodb_driver` will start a single
117
117
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
118
118
function calls in `Mongo` using the pool:
@@ -148,17 +148,31 @@ Due to the mongodb specification, an additional connection is always set up for
148
148
149
149
### Replica Sets
150
150
151
-
To connect to a Mongo cluster that is using replica sets, it is recommended to use the `:seeds` list instead
152
-
of a `:hostname` and `:port` pair.
151
+
By default, the driver will discover the deployment's topology and will connect
152
+
to the replica set automatically, using either the seed list syntax or the URI
153
+
syntax. Assuming the deployment has nodes at `hostname1.net:27017`,
154
+
`hostname2.net:27017` and `hostname3.net:27017`, either of the following
This will allow for scenarios where the first `"hostname1.net:27017"` is unreachable for any reason
159
-
and will automatically try to connect to each of the following entries in the list to connect to the cluster.
173
+
Using an SRV URI also discovers all nodes of the deployment automatically.
160
174
161
-
### Auth mechanisms
175
+
### Auth Mechanisms
162
176
163
177
For versions of Mongo 3.0 and greater, the auth mechanism defaults to SCRAM.
164
178
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 +182,7 @@ authentication, you can specify that as a `start_link` option.
You specify the `indexes` parameter as a keyword list with all options described in the documentation of the [createIndex](https://docs.mongodb.com/manual/reference/command/createIndexes/#dbcmd.createIndexes) command.
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
406
437
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:
407
438
408
-
### Example
409
-
410
439
```bash
411
440
pyenv global 3.6
412
441
pip3 install --upgrade pip
@@ -418,11 +447,11 @@ mix test --exclude ssl --exclude socket
* For `--sslMode` you can use one of `allowSSL` or `preferSSL`
434
463
* You can enable any other options you want when starting `mongod`
435
464
436
-
## More examples
465
+
## More Examples
437
466
438
467
There are some basic examples in the `example` folder. But if you want to see the driver in action
439
468
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
440
469
bulk operations.
441
470
442
-
## Special thanks
471
+
## Special Thanks
443
472
444
473
Special thanks to [JetBrains](https://www.jetbrains.com/?from=elixir-mongodb-driver) for providing a free JetBrains Open Source license for their complete toolbox.
445
474
446
475
The [Documentation](https://hexdocs.pm/mongodb_driver/readme.html) is online, but currently not up to date.
447
476
This will be done as soon as possible. In the meantime, look in the source code. Especially
448
477
for the individual options.
449
478
450
-
This driver is based on [original](https://github.com/ankhers/mongodb).
479
+
This driver is based on the [original Elixir driver for MongoDB](https://github.com/ankhers/mongodb).
0 commit comments