Skip to content

Commit 7ee64c1

Browse files
committed
fix: logic for datbase connection
1 parent f437018 commit 7ee64c1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ agenda.processEvery('3 days, 4 hours and 36 seconds');
211211
Specifies the database at the `url` specified. If no collection name is given,
212212
`agendaJobs` is used.
213213

214+
By default `useNewUrlParser` and `useUnifiedTopology` is set to `true`,
215+
214216
```js
215217
agenda.database('localhost:27017/agenda-test', 'agendaJobs');
216218
```

src/JobDbRepository.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ export class JobDbRepository {
208208
connectionString = `mongodb://${connectionString}`;
209209
}
210210

211-
const client = await MongoClient.connect(url, {
212-
...options,
211+
const client = await MongoClient.connect(connectionString, {
213212
useNewUrlParser: true,
214-
useUnifiedTopology: true
213+
useUnifiedTopology: true,
214+
...options
215215
});
216216

217217
return client.db();

0 commit comments

Comments
 (0)