sharedb-mongo 2.1.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test.yml +1 -0
- package/index.js +3 -18
- package/package.json +3 -5
package/index.js
CHANGED
|
@@ -126,16 +126,6 @@ ShareDbMongo.prototype.getDbs = function(callback) {
|
|
|
126
126
|
}, callback);
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
function isLegacyMongoClient(client) {
|
|
130
|
-
// mongodb 2.0 connect returns a DB object that also implements the
|
|
131
|
-
// functionality of client, such as `close()`. mongodb 3.0 connect returns a
|
|
132
|
-
// Client without the `collection()` method
|
|
133
|
-
return (
|
|
134
|
-
typeof client.collection === 'function' &&
|
|
135
|
-
typeof client.close === 'function'
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
129
|
ShareDbMongo.prototype._connect = function(mongo, options) {
|
|
140
130
|
// Create the mongo connection client connections if needed
|
|
141
131
|
//
|
|
@@ -148,17 +138,12 @@ ShareDbMongo.prototype._connect = function(mongo, options) {
|
|
|
148
138
|
return Promise.all(connections).then(function(clients) {
|
|
149
139
|
var mongoClient = clients[0];
|
|
150
140
|
var mongoPollClient = clients[1];
|
|
151
|
-
|
|
152
|
-
mongo: mongoClient,
|
|
141
|
+
return {
|
|
142
|
+
mongo: mongoClient.db(),
|
|
153
143
|
mongoClient: mongoClient,
|
|
154
|
-
mongoPoll: mongoPollClient,
|
|
144
|
+
mongoPoll: mongoPollClient && mongoPollClient.db(),
|
|
155
145
|
mongoPollClient: mongoPollClient
|
|
156
146
|
};
|
|
157
|
-
if (!isLegacyMongoClient(mongoClient)) {
|
|
158
|
-
result.mongo = mongoClient.db();
|
|
159
|
-
if (mongoPollClient) result.mongoPoll = mongoPollClient.db();
|
|
160
|
-
}
|
|
161
|
-
return result;
|
|
162
147
|
});
|
|
163
148
|
};
|
|
164
149
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sharedb-mongo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "MongoDB database adapter for ShareDB",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"mongodb": "^
|
|
7
|
+
"mongodb": "^3.1.13 || ^4.0.0 || ^5.0.0",
|
|
8
8
|
"sharedb": "^1.9.1 || ^2.0.0 || ^3.0.0"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"eslint": "^5.16.0",
|
|
15
15
|
"eslint-config-google": "^0.13.0",
|
|
16
16
|
"mocha": "^6.2.2",
|
|
17
|
-
"mongodb2": "npm:mongodb@^2.1.2",
|
|
18
17
|
"mongodb3": "npm:mongodb@^3.0.0",
|
|
19
18
|
"mongodb4": "npm:mongodb@^4.0.0",
|
|
20
19
|
"mongodb5": "npm:mongodb@^5.0.0",
|
|
@@ -28,11 +27,10 @@
|
|
|
28
27
|
"lint": "./node_modules/.bin/eslint --ignore-path .gitignore '**/*.js'",
|
|
29
28
|
"lint:fix": "npm run lint -- --fix",
|
|
30
29
|
"test": "mocha",
|
|
31
|
-
"test:mongodb2": "_SHAREDB_MONGODB_DRIVER=mongodb2 npm test",
|
|
32
30
|
"test:mongodb3": "_SHAREDB_MONGODB_DRIVER=mongodb3 npm test",
|
|
33
31
|
"test:mongodb4": "_SHAREDB_MONGODB_DRIVER=mongodb4 npm test",
|
|
34
32
|
"test:mongodb5": "_SHAREDB_MONGODB_DRIVER=mongodb5 npm test",
|
|
35
|
-
"test:all": "npm run test:
|
|
33
|
+
"test:all": "npm run test:mongodb3 && npm run test:mongodb4 && npm run test:mongodb5",
|
|
36
34
|
"test-cover": "nyc --temp-dir=coverage -r text -r lcov npm run test:all"
|
|
37
35
|
},
|
|
38
36
|
"repository": "git://github.com/share/sharedb-mongo.git",
|