Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "MongoDB milestone snapshot database adapter for ShareDB",
"main": "lib/index.js",
"dependencies": {
"mongodb": "^2.2.36 || ^3.0.0 || ^4.0.0",
"mongodb": "^2.2.36 || ^3.0.0 || ^4.0.0 || ^5.0.0",
"sharedb": "^1.0.0 || ^2.0.0 || ^3.0.0"
},
"devDependencies": {
Expand All @@ -15,6 +15,7 @@
"mongodb2": "npm:mongodb@^2.2.36",
"mongodb3": "npm:mongodb@^3.0.0",
"mongodb4": "npm:mongodb@^4.0.0",
"mongodb5": "npm:mongodb@^5.0.0",
"nyc": "^15.1.0"
},
"scripts": {
Expand Down
13 changes: 8 additions & 5 deletions test/mongo-milestone-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ const mongodbRequire = require('../lib/mongodb');

const MONGO_URL = process.env.TEST_MONGO_URL || 'mongodb://localhost:27017/test';

['mongodb2', 'mongodb3', 'mongodb4'].forEach((driver) => {
[
'mongodb2',
'mongodb3',
'mongodb4',
'mongodb5',
].forEach((driver) => {
const mongodb = require(driver);

function create(options, callback) {
Expand Down Expand Up @@ -111,8 +116,7 @@ const MONGO_URL = process.env.TEST_MONGO_URL || 'mongodb://localhost:27017/test'

db.saveMilestoneSnapshot('testcollection', snapshot, (saveError) => {
if (saveError) return done(saveError);
mongo.collection('m_testcollection').indexInformation((indexError, indexes) => {
if (indexError) return done(indexError);
mongo.collection('m_testcollection').indexInformation().then((indexes) => {
expect(indexes.d_1_v_1).to.be.ok;
expect(indexes['m.mtime_1']).to.be.ok;
done();
Expand Down Expand Up @@ -163,8 +167,7 @@ const MONGO_URL = process.env.TEST_MONGO_URL || 'mongodb://localhost:27017/test'

db.saveMilestoneSnapshot('testcollection', snapshot, (saveError) => {
if (saveError) return done(saveError);
mongo.collection('m_testcollection').indexInformation((indexError, indexes) => {
if (indexError) return done(indexError);
mongo.collection('m_testcollection').indexInformation().then((indexes) => {
expect(indexes.id_1_v_1).not.to.be.ok;
done();
});
Expand Down