mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Upgrade Mongo driver to latest legacy-API compatible version
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
const _ = require('lodash')
|
||||
, checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$")
|
||||
, ObjectID = require('mongodb').ObjectID
|
||||
, ObjectID = require('mongodb-legacy').ObjectID
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
var _ = require('lodash');
|
||||
var crypto = require('crypto');
|
||||
var shiroTrie = require('shiro-trie');
|
||||
var ObjectID = require('mongodb').ObjectID;
|
||||
var ObjectID = require('mongodb-legacy').ObjectID;
|
||||
|
||||
var find_options = require('../server/query');
|
||||
|
||||
@@ -42,7 +42,7 @@ function init (env, ctx) {
|
||||
}
|
||||
|
||||
function list (collection) {
|
||||
function doList(opts, fn) {
|
||||
function doList(opts, fn) {
|
||||
// these functions, find, sort, and limit, are used to
|
||||
// dynamically configure the request, based on the options we've
|
||||
// been given
|
||||
@@ -65,6 +65,8 @@ function init (env, ctx) {
|
||||
fn(err, entries);
|
||||
}
|
||||
|
||||
console.log('Loading',opts);
|
||||
|
||||
// now just stitch them all together
|
||||
limit.call(collection
|
||||
.find(query_for(opts))
|
||||
@@ -135,8 +137,14 @@ function init (env, ctx) {
|
||||
|
||||
storage.reload = function reload (callback) {
|
||||
|
||||
console.log('Reloading auth data');
|
||||
|
||||
storage.listRoles({sort: {name: 1}}, function listResults (err, results) {
|
||||
|
||||
console.log('Roles listed');
|
||||
|
||||
if (err) {
|
||||
console.log('Problem listing roles', err);
|
||||
return callback && callback(err);
|
||||
}
|
||||
|
||||
@@ -152,6 +160,7 @@ function init (env, ctx) {
|
||||
|
||||
storage.listSubjects({sort: {name: 1}}, function listResults (err, results) {
|
||||
if (err) {
|
||||
console.log('Problem listing subjects', err);
|
||||
return callback && callback(err);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ var find_options = require('./query');
|
||||
|
||||
|
||||
function storage (env, ctx) {
|
||||
var ObjectID = require('mongodb').ObjectID;
|
||||
var ObjectID = require('mongodb-legacy').ObjectID;
|
||||
|
||||
function create (obj, fn) {
|
||||
obj.created_at = (new Date( )).toISOString( );
|
||||
|
||||
@@ -7,7 +7,9 @@ function boot (env, language) {
|
||||
|
||||
function startBoot(ctx, next) {
|
||||
|
||||
console.log('Executing startBoot');
|
||||
console.log('++++++++++++++++++++++++++++++');
|
||||
console.log('Nightscout Executing startBoot');
|
||||
console.log('++++++++++++++++++++++++++++++');
|
||||
|
||||
ctx.moment = require('moment-timezone');
|
||||
ctx.runtimeState = 'booting';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
var es = require('event-stream');
|
||||
var find_options = require('./query');
|
||||
var ObjectID = require('mongodb').ObjectID;
|
||||
var ObjectID = require('mongodb-legacy').ObjectID;
|
||||
var moment = require('moment');
|
||||
|
||||
/**********\
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
function storage (env, ctx) {
|
||||
var ObjectID = require('mongodb').ObjectID;
|
||||
var ObjectID = require('mongodb-legacy').ObjectID;
|
||||
|
||||
function create (obj, fn) {
|
||||
obj.created_at = (new Date( )).toISOString( );
|
||||
|
||||
@@ -4,7 +4,7 @@ var find_options = require('./query');
|
||||
var consts = require('../constants');
|
||||
|
||||
function storage (collection, ctx) {
|
||||
var ObjectID = require('mongodb').ObjectID;
|
||||
var ObjectID = require('mongodb-legacy').ObjectID;
|
||||
|
||||
function create (obj, fn) {
|
||||
obj.created_at = (new Date( )).toISOString( );
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const traverse = require('traverse');
|
||||
const ObjectID = require('mongodb').ObjectID;
|
||||
const ObjectID = require('mongodb-legacy').ObjectID;
|
||||
const moment = require('moment');
|
||||
|
||||
const TWO_DAYS = 172800000;
|
||||
|
||||
@@ -6,7 +6,7 @@ var moment = require('moment');
|
||||
var find_options = require('./query');
|
||||
|
||||
function storage (env, ctx) {
|
||||
var ObjectID = require('mongodb').ObjectID;
|
||||
var ObjectID = require('mongodb-legacy').ObjectID;
|
||||
|
||||
function create (objOrArray, fn) {
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
var times = require('../times');
|
||||
var calcData = require('../data/calcdelta');
|
||||
var ObjectID = require('mongodb').ObjectID;
|
||||
var ObjectID = require('mongodb-legacy').ObjectID;
|
||||
const forwarded = require('forwarded-for');
|
||||
|
||||
function getRemoteIP (req) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const MongoClient = require('mongodb-legacy').MongoClient;
|
||||
|
||||
const mongo = {
|
||||
client: null,
|
||||
@@ -82,10 +82,11 @@ function init(env, cb, forceNewConnection) {
|
||||
|
||||
mongo.ensureIndexes = function ensureIndexes(collection, fields) {
|
||||
fields.forEach(function (field) {
|
||||
console.info('ensuring index for: ' + field);
|
||||
const name = collection.collectionName + "." + field;
|
||||
console.info('ensuring index for: ' + name);
|
||||
collection.createIndex(field, { 'background': true }, function (err) {
|
||||
if (err) {
|
||||
console.error('unable to ensureIndex for: ' + field + ' - ' + err);
|
||||
console.error('unable to ensureIndex for: ' + name + ' - ' + err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Generated
+13815
-198
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -115,7 +115,7 @@
|
||||
"moment-timezone": "^0.5.31",
|
||||
"moment-timezone-data-webpack-plugin": "^1.5.0",
|
||||
"mongo-url-parser": "^1.0.2",
|
||||
"mongodb": "^3.6.0",
|
||||
"mongodb-legacy": "^5.0.0",
|
||||
"mongomock": "^0.1.2",
|
||||
"node-cache": "^4.2.1",
|
||||
"parse-duration": "^0.1.3",
|
||||
|
||||
Reference in New Issue
Block a user