Skip to content

Commit fe47b50

Browse files
committed
fix workflows, use node debuglog instead of debug
1 parent 4b9b3af commit fe47b50

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
node: ['lts/*', 'lts/-1', 'latest']
15+
node: ['20', '22', '24']
1616
mongo: [7.0, 8.0]
1717
services:
1818
mongodb:

lib/mquery.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const assert = require('assert');
88
const util = require('util');
99
const utils = require('./utils');
1010

11+
const debug = util.debuglog('mquery');
12+
1113
/**
1214
* Query constructor used for building queries.
1315
*
@@ -1833,6 +1835,8 @@ Query.prototype._find = async function _find() {
18331835
options.fields = this._fieldsForExec();
18341836
}
18351837

1838+
debug('find', this._collection.collectionName, conds, options);
1839+
18361840
return this._collection.find(conds, options);
18371841
};
18381842

@@ -1867,6 +1871,8 @@ Query.prototype.cursor = function cursor(criteria) {
18671871
options.fields = this._fieldsForExec();
18681872
}
18691873

1874+
debug('findCursor', this._collection.collectionName, conds, options);
1875+
18701876
return this._collection.findCursor(conds, options);
18711877
};
18721878

@@ -1910,6 +1916,8 @@ Query.prototype._findOne = async function _findOne() {
19101916
options.fields = this._fieldsForExec();
19111917
}
19121918

1919+
debug('findOne', this._collection.collectionName, conds, options);
1920+
19131921
return this._collection.findOne(conds, options);
19141922
};
19151923

@@ -1951,6 +1959,8 @@ Query.prototype._countDocuments = async function _countDocuments() {
19511959
const conds = this._conditions;
19521960
const options = this._optionsForExec();
19531961

1962+
debug('countDocuments', this._collection.collectionName, conds, options);
1963+
19541964
return this._collection.countDocuments(conds, options);
19551965
};
19561966

@@ -1982,6 +1992,7 @@ Query.prototype.estimatedDocumentCount = function() {
19821992
Query.prototype._estimatedDocumentCount = async function _estimatedDocumentCount() {
19831993
const conds = this._conditions;
19841994
const options = this._optionsForExec();
1995+
debug('estimatedDocumentCount', this._collection.collectionName, conds, options);
19851996
return this._collection.estimatedDocumentCount(conds, options);
19861997
};
19871998

@@ -2165,6 +2176,7 @@ async function _updateExec(query, op) {
21652176
const criteria = query._conditions;
21662177
const doc = query._updateForExec();
21672178

2179+
debug(op, query._collection.collectionName, criteria, doc, options);
21682180
return query._collection[op](criteria, doc, options);
21692181
}
21702182

@@ -2200,6 +2212,7 @@ Query.prototype._deleteOne = async function() {
22002212

22012213
const conds = this._conditions;
22022214

2215+
debug('deleteOne', this._collection.collectionName, conds, options);
22032216
return this._collection.deleteOne(conds, options);
22042217
};
22052218

@@ -2358,6 +2371,7 @@ Query.prototype._findOneAndReplace = async function() {
23582371
const replacement = this._updateForExec();
23592372
const options = this._optionsForExec();
23602373

2374+
debug('findOneAndReplace', this._collection.collectionName, conds, replacement, options);
23612375
return this._collection.findOneAndReplace(conds, replacement, options);
23622376
};
23632377

@@ -2407,6 +2421,7 @@ Query.prototype._findOneAndDelete = async function() {
24072421
const options = this._optionsForExec();
24082422
const conds = this._conditions;
24092423

2424+
debug('findOneAndDelete', this._collection.collectionName, conds, options);
24102425
return this._collection.findOneAndDelete(conds, options);
24112426
};
24122427

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"url": "git://github.com/aheckmann/mquery.git"
1414
},
1515
"engines": {
16-
"node": ">=16.0.0"
16+
"node": ">=20.19.0"
1717
},
1818
"devDependencies": {
1919
"eslint": "8.x",

test/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,15 +1984,15 @@ describe('mquery', function() {
19841984
}
19851985

19861986
describe('findOneAndUpdate', function() {
1987-
let name = 'findOneAndUpdate + fn';
1987+
const name = 'findOneAndUpdate + fn';
19881988

19891989
validateFindAndModifyOptions('findOneAndUpdate');
19901990

19911991
beforeEach(function() {
19921992
return mquery().collection(col).updateOne({ name }, { name }, { upsert: true });
19931993
});
19941994

1995-
afterEach(function () {
1995+
afterEach(function() {
19961996
return mquery().collection(col).deleteMany();
19971997
});
19981998

@@ -2066,15 +2066,15 @@ describe('mquery', function() {
20662066
});
20672067

20682068
describe('findOneAndReplace', function() {
2069-
let name = 'findOneAndReplace + fn';
2069+
const name = 'findOneAndReplace + fn';
20702070

20712071
validateFindAndModifyOptions('findOneAndReplace');
20722072

20732073
beforeEach(function() {
20742074
return mquery().collection(col).updateOne({ name }, { name }, { upsert: true });
20752075
});
20762076

2077-
afterEach(function () {
2077+
afterEach(function() {
20782078
return mquery().collection(col).deleteMany();
20792079
});
20802080

0 commit comments

Comments
 (0)