Skip to content

Commit a2e74a9

Browse files
committed
fix: use new mongo stack
1 parent 4b683e7 commit a2e74a9

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hokify/agenda",
3-
"version": "4.0.5",
3+
"version": "4.0.6",
44
"description": "Light weight job scheduler for Node.js",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/JobDbRepository.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ export class JobDbRepository {
147147

148148
this.collection = db.collection(collection);
149149
log(
150-
`connected with collection: ${collection}, collection size: ${await this.collection.estimatedDocumentCount()}`
150+
`connected with collection: ${collection}, collection size: ${
151+
typeof this.collection.estimatedDocumentCount === 'function'
152+
? await this.collection.estimatedDocumentCount()
153+
: '?'
154+
}`
151155
);
152156

153157
if (this.connectOptions.ensureIndex) {
@@ -183,7 +187,12 @@ export class JobDbRepository {
183187
reconnectTries: Number.MAX_SAFE_INTEGER
184188
};
185189

186-
const client = await MongoClient.connect(url, { ...reconnectOptions, ...options });
190+
const client = await MongoClient.connect(url, {
191+
...reconnectOptions,
192+
...options,
193+
useNewUrlParser: true,
194+
useUnifiedTopology: true
195+
});
187196

188197
return client.db();
189198
}

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class Agenda extends EventEmitter {
4747

4848
private jobProcessor?: JobProcessor;
4949

50-
private ready: Promise<unknown>;
50+
private ready: Promise<void>;
5151

5252
getRunningStats() {
5353
if (!this.jobProcessor) {

0 commit comments

Comments
 (0)