mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
fixed #3218
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
nconf = require('nconf'),
|
||||
session = require('express-session'),
|
||||
_ = require('underscore'),
|
||||
semver = require('semver'),
|
||||
db, mongoClient;
|
||||
|
||||
_.mixin(require('underscore.deep'));
|
||||
@@ -137,6 +138,7 @@
|
||||
}
|
||||
|
||||
function createIndices() {
|
||||
winston.info('[database] Checking database indices.')
|
||||
async.parallel([
|
||||
async.apply(createIndex, 'objects', {_key: 1, score: -1}, {background: true}),
|
||||
async.apply(createIndex, 'objects', {_key: 1, value: -1}, {background: true, unique: true, sparse: true}),
|
||||
@@ -164,6 +166,17 @@
|
||||
});
|
||||
};
|
||||
|
||||
module.checkCompatibility = function(callback) {
|
||||
// For MongoDB, we need to ensure that the mongodb package is >= 2.0.0
|
||||
var mongoPkg = require.main.require('./node_modules/mongodb/package.json'),
|
||||
err = semver.lt(mongoPkg.version, '2.0.0') ? new Error('The `mongodb` package is out-of-date, please run `./nodebb setup` again.') : null;
|
||||
|
||||
if (err) {
|
||||
err.stacktrace = false;
|
||||
}
|
||||
callback(err);
|
||||
};
|
||||
|
||||
module.info = function(db, callback) {
|
||||
db.stats({scale:1024}, function(err, stats) {
|
||||
if(err) {
|
||||
|
||||
Reference in New Issue
Block a user