Skip to content

Commit

Permalink
fix: logic for datbase connection
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Oct 24, 2020
1 parent f437018 commit 7ee64c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ agenda.processEvery('3 days, 4 hours and 36 seconds');
Specifies the database at the `url` specified. If no collection name is given,
`agendaJobs` is used.

By default `useNewUrlParser` and `useUnifiedTopology` is set to `true`,

```js
agenda.database('localhost:27017/agenda-test', 'agendaJobs');
```
Expand Down
6 changes: 3 additions & 3 deletions src/JobDbRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ export class JobDbRepository {
connectionString = `mongodb://${connectionString}`;
}

const client = await MongoClient.connect(url, {
...options,
const client = await MongoClient.connect(connectionString, {
useNewUrlParser: true,
useUnifiedTopology: true
useUnifiedTopology: true,
...options
});

return client.db();
Expand Down

0 comments on commit 7ee64c1

Please sign in to comment.