...
1# MongoDB
2
3* Driver work with mongo through [db.runCommands](https://docs.mongodb.com/manual/reference/command/)
4* Migrations support json format. It contains array of commands for `db.runCommand`. Every command is executed in separate request to database
5* All keys have to be in quotes `"`
6* [Examples](./examples)
7
8# Usage
9
10`mongodb://user:password@host:port/dbname?query` (`mongodb+srv://` also works, but behaves a bit differently. See [docs](https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format) for more information)
11
12| URL Query | WithInstance Config | Description |
13|------------|---------------------|-------------|
14| `x-migrations-collection` | `MigrationsCollection` | Name of the migrations collection |
15| `x-transaction-mode` | `TransactionMode` | If set to `true` wrap commands in [transaction](https://docs.mongodb.com/manual/core/transactions). Available only for replica set. Driver is using [strconv.ParseBool](https://golang.org/pkg/strconv/#ParseBool) for parsing|
16| `x-advisory-locking` | `true` | Feature flag for advisory locking, if set to false, disable advisory locking |
17| `x-advisory-lock-collection` | `migrate_advisory_lock` | The name of the collection to use for advisory locking.|
18| `x-advisory-lock-timout` | `15` | The max time in seconds that the advisory lock will wait if the db is already locked. |
19| `x-advisory-lock-timout-interval` | `10` | The max timeout in seconds interval that the advisory lock will wait if the db is already locked. |
20| `dbname` | `DatabaseName` | The name of the database to connect to |
21| `user` | | The user to sign in as. Can be omitted |
22| `password` | | The user's password. Can be omitted |
23| `host` | | The host to connect to |
24| `port` | | The port to bind to |
View as plain text