Skip to content

Commit d9e6a85

Browse files
committed
test: remove "mongo24|6_or_greater" check
because since mongoose 5.x, versions below mongodb 3.0.0 are unsupported, so we are always above.
1 parent 57678f5 commit d9e6a85

File tree

3 files changed

+4
-80
lines changed

3 files changed

+4
-80
lines changed

test/aggregate.test.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -817,12 +817,6 @@ describe('aggregate: ', function() {
817817

818818
it('explain()', async function() {
819819
const aggregate = new Aggregate([], db.model('Employee'));
820-
const version = await start.mongodVersion();
821-
822-
const mongo26 = version[0] > 2 || (version[0] === 2 && version[1] >= 6);
823-
if (!mongo26) {
824-
return;
825-
}
826820

827821
const output = await aggregate.
828822
match({ sal: { $lt: 16000 } }).
@@ -868,16 +862,13 @@ describe('aggregate: ', function() {
868862
const match = { $match: { sal: { $gt: 15000 } } };
869863
const pref = 'primaryPreferred';
870864
const aggregate = m.aggregate([match]).read(pref);
871-
const mongo26_or_greater = version[0] > 2 || (version[0] === 2 && version[1] >= 6);
872865
const mongo32_or_greater = version[0] > 3 || (version[0] === 3 && version[1] >= 2);
873866

874867
assert.equal(aggregate.options.readPreference.mode, pref);
875-
if (mongo26_or_greater) {
876-
aggregate.allowDiskUse(true);
877-
aggregate.option({ maxTimeMS: 1000 });
878-
assert.equal(aggregate.options.allowDiskUse, true);
879-
assert.equal(aggregate.options.maxTimeMS, 1000);
880-
}
868+
aggregate.allowDiskUse(true);
869+
aggregate.option({ maxTimeMS: 1000 });
870+
assert.equal(aggregate.options.allowDiskUse, true);
871+
assert.equal(aggregate.options.maxTimeMS, 1000);
881872

882873
if (mongo32_or_greater) {
883874
aggregate.readConcern('m');

test/model.aggregate.test.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ describe('model aggregate', function() {
3030
const project = { $project: { maxAge: 1, _id: 0 } };
3131
let db, A, maxAge;
3232

33-
let mongo26_or_greater = false;
34-
3533
before(async function() {
3634
db = start();
3735
A = db.model('Test', userSchema);
@@ -49,14 +47,6 @@ describe('model aggregate', function() {
4947
}
5048

5149
await A.create(docs);
52-
53-
const version = await start.mongodVersion();
54-
55-
mongo26_or_greater = version[0] > 2 || (version[0] === 2 && version[1] >= 6);
56-
57-
if (!mongo26_or_greater) {
58-
console.log('not testing mongodb 2.6 features');
59-
}
6050
});
6151

6252
after(async function() {
@@ -114,10 +104,6 @@ describe('model aggregate', function() {
114104
});
115105

116106
it('can use helper for $out', async function() {
117-
if (!mongo26_or_greater) {
118-
return;
119-
}
120-
121107
const outputCollection = 'aggregate_output_' + random();
122108
await A.aggregate()
123109
.group(group.$group)

test/model.querying.test.js

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ describe('model: querying:', function() {
6868
geoSchema = new Schema({ loc: { type: [Number], index: '2d' } });
6969
});
7070

71-
let mongo26_or_greater = false;
72-
before(async function() {
73-
const version = await start.mongodVersion();
74-
75-
mongo26_or_greater = version[0] > 2 || (version[0] === 2 && version[1] >= 6);
76-
if (!mongo26_or_greater) {
77-
console.log('not testing mongodb 2.6 features');
78-
}
79-
});
80-
8171
after(async function() {
8272
await db.close();
8373
});
@@ -1080,14 +1070,6 @@ describe('model: querying:', function() {
10801070
});
10811071

10821072
it('with $elemMatch (gh-3163)', async function() {
1083-
const version = await start.mongodVersion();
1084-
1085-
const mongo26_or_greater = version[0] > 2 || (version[0] === 2 && version[1] >= 6);
1086-
if (!mongo26_or_greater) {
1087-
return;
1088-
}
1089-
1090-
10911073
const schema = new Schema({ test: [String] });
10921074
const MyModel = db.model('Test', schema);
10931075

@@ -1377,23 +1359,7 @@ describe('model: querying:', function() {
13771359
// geoMultiSchema.index({ geom: '2dsphere' });
13781360
});
13791361

1380-
// mongodb 2.4
1381-
let mongo24_or_greater = false;
1382-
before(async function() {
1383-
const version = await start.mongodVersion();
1384-
1385-
mongo24_or_greater = version[0] > 2 || (version[0] === 2 && version[1] >= 4);
1386-
1387-
if (!mongo24_or_greater) {
1388-
console.log('not testing mongodb 2.4 features');
1389-
}
1390-
});
1391-
13921362
it('index is allowed in schema', function(done) {
1393-
if (!mongo24_or_greater) {
1394-
return done();
1395-
}
1396-
13971363
const ok = schema2dsphere.indexes().some(function(index) {
13981364
return index[0].loc === '2dsphere';
13991365
});
@@ -1403,10 +1369,6 @@ describe('model: querying:', function() {
14031369

14041370
describe('$geometry', function() {
14051371
it('Polygon', async function() {
1406-
if (!mongo24_or_greater) {
1407-
return;
1408-
}
1409-
14101372
const Test = db.model('Test', schema2dsphere);
14111373
await Test.init();
14121374

@@ -1527,10 +1489,6 @@ describe('model: querying:', function() {
15271489

15281490
});
15291491
it('works with legacy 2dsphere pair in schema (gh-6937)', async function() {
1530-
if (!mongo24_or_greater) {
1531-
return it.skip();
1532-
}
1533-
15341492
const Model = db.model('Test', schema2dsphere);
15351493
await Model.init();
15361494
const model = new Model();
@@ -1543,17 +1501,6 @@ describe('model: querying:', function() {
15431501
});
15441502

15451503
describe('hashed indexes', function() {
1546-
let mongo24_or_greater = false;
1547-
1548-
before(async function() {
1549-
const version = await start.mongodVersion();
1550-
1551-
mongo24_or_greater = version[0] > 2 || (version[0] === 2 && version[1] >= 4);
1552-
if (!mongo24_or_greater) {
1553-
console.log('not testing mongodb 2.4 features');
1554-
}
1555-
});
1556-
15571504
it('work', async function() {
15581505
const schema = new Schema({ t: { type: String, index: 'hashed' } });
15591506

0 commit comments

Comments
 (0)