mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-11 07:00:51 +01:00
ESlint comma-dangle
This commit is contained in:
@@ -17,30 +17,30 @@
|
||||
{
|
||||
name: 'mongo:host',
|
||||
description: 'Host IP or address of your MongoDB instance',
|
||||
'default': nconf.get('mongo:host') || '127.0.0.1'
|
||||
'default': nconf.get('mongo:host') || '127.0.0.1',
|
||||
},
|
||||
{
|
||||
name: 'mongo:port',
|
||||
description: 'Host port of your MongoDB instance',
|
||||
'default': nconf.get('mongo:port') || 27017
|
||||
'default': nconf.get('mongo:port') || 27017,
|
||||
},
|
||||
{
|
||||
name: 'mongo:username',
|
||||
description: 'MongoDB username',
|
||||
'default': nconf.get('mongo:username') || ''
|
||||
'default': nconf.get('mongo:username') || '',
|
||||
},
|
||||
{
|
||||
name: 'mongo:password',
|
||||
description: 'Password of your MongoDB database',
|
||||
hidden: true,
|
||||
default: nconf.get('mongo:password') || '',
|
||||
before: function (value) { value = value || nconf.get('mongo:password') || ''; return value; }
|
||||
before: function (value) { value = value || nconf.get('mongo:password') || ''; return value; },
|
||||
},
|
||||
{
|
||||
name: "mongo:database",
|
||||
description: "MongoDB database name",
|
||||
'default': nconf.get('mongo:database') || 'nodebb'
|
||||
}
|
||||
'default': nconf.get('mongo:database') || 'nodebb',
|
||||
},
|
||||
];
|
||||
|
||||
module.helpers = module.helpers || {};
|
||||
@@ -84,8 +84,8 @@
|
||||
|
||||
var connOptions = {
|
||||
server: {
|
||||
poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10
|
||||
}
|
||||
poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10,
|
||||
},
|
||||
};
|
||||
|
||||
connOptions = _.deepExtend((nconf.get('mongo:options') || {}), connOptions);
|
||||
@@ -135,13 +135,13 @@
|
||||
|
||||
module.sessionStore = new sessionStore({
|
||||
client: rdb.client,
|
||||
ttl: ttl
|
||||
ttl: ttl,
|
||||
});
|
||||
} else if (nconf.get('mongo')) {
|
||||
sessionStore = require('connect-mongo')(session);
|
||||
module.sessionStore = new sessionStore({
|
||||
db: db,
|
||||
ttl: ttl
|
||||
ttl: ttl,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
async.series([
|
||||
async.apply(createIndex, 'objects', { _key: 1, score: -1 }, { background: true }),
|
||||
async.apply(createIndex, 'objects', { _key: 1, value: -1 }, { background: true, unique: true, sparse: true }),
|
||||
async.apply(createIndex, 'objects', { expireAt: 1 }, { expireAfterSeconds: 0, background: true })
|
||||
async.apply(createIndex, 'objects', { expireAt: 1 }, { expireAfterSeconds: 0, background: true }),
|
||||
], function (err) {
|
||||
if (err) {
|
||||
winston.error('Error creating index ' + err.message);
|
||||
@@ -203,7 +203,7 @@
|
||||
db.collection(collection.name).stats(next);
|
||||
}, next);
|
||||
});
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -219,7 +219,7 @@
|
||||
avgObjSize: collectionInfo.avgObjSize,
|
||||
storageSize: collectionInfo.storageSize,
|
||||
totalIndexSize: collectionInfo.totalIndexSize,
|
||||
indexSizes: collectionInfo.indexSizes
|
||||
indexSizes: collectionInfo.indexSizes,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ module.exports = function (db, module) {
|
||||
}
|
||||
field = helpers.fieldToString(field);
|
||||
var _fields = {
|
||||
_id: 0
|
||||
_id: 0,
|
||||
};
|
||||
_fields[field] = 1;
|
||||
db.collection('objects').findOne({_key: key}, {fields: _fields}, function (err, item) {
|
||||
@@ -75,7 +75,7 @@ module.exports = function (db, module) {
|
||||
return callback();
|
||||
}
|
||||
var _fields = {
|
||||
_id: 0
|
||||
_id: 0,
|
||||
};
|
||||
|
||||
for(var i = 0; i < fields.length; ++i) {
|
||||
@@ -101,7 +101,7 @@ module.exports = function (db, module) {
|
||||
}
|
||||
var _fields = {
|
||||
_id: 0,
|
||||
_key: 1
|
||||
_key: 1,
|
||||
};
|
||||
|
||||
for(var i = 0; i < fields.length; ++i) {
|
||||
|
||||
@@ -14,16 +14,16 @@ module.exports = function (db, module) {
|
||||
});
|
||||
|
||||
db.collection('objects').update({
|
||||
_key: key
|
||||
_key: key,
|
||||
}, {
|
||||
$addToSet: {
|
||||
members: {
|
||||
$each: value
|
||||
}
|
||||
}
|
||||
$each: value,
|
||||
},
|
||||
},
|
||||
}, {
|
||||
upsert: true,
|
||||
w: 1
|
||||
w: 1,
|
||||
}, function (err, res) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -49,8 +49,8 @@ module.exports = function (db, module) {
|
||||
for(var i = 0; i < keys.length; ++i) {
|
||||
bulk.find({_key: keys[i]}).upsert().updateOne({ $addToSet: {
|
||||
members: {
|
||||
$each: value
|
||||
}
|
||||
$each: value,
|
||||
},
|
||||
}});
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ module.exports = function (db, module) {
|
||||
|
||||
for(var i = 0; i < keys.length; ++i) {
|
||||
bulk.find({_key: keys[i]}).updateOne({$pull: {
|
||||
members: value
|
||||
members: value,
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ module.exports = function (db, module) {
|
||||
var pipeline = [
|
||||
{ $match : { _key : { $in: keys } } } ,
|
||||
{ $group: { _id: {_key: '$_key'}, count: { $sum: 1 } } },
|
||||
{ $project: { _id: 1, count: '$count' } }
|
||||
{ $project: { _id: 1, count: '$count' } },
|
||||
];
|
||||
db.collection('objects').aggregate(pipeline, function (err, results) {
|
||||
if (err) {
|
||||
@@ -500,7 +500,7 @@ module.exports = function (db, module) {
|
||||
});
|
||||
});
|
||||
},
|
||||
callback
|
||||
callback,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = function (db, module) {
|
||||
{ $match: { _key: {$in: keys}} },
|
||||
{ $group: { _id: {value: '$value'}, count: {$sum: 1}} },
|
||||
{ $match: { count: keys.length} },
|
||||
{ $group: { _id: null, count: { $sum: 1 } } }
|
||||
{ $group: { _id: null, count: { $sum: 1 } } },
|
||||
];
|
||||
|
||||
db.collection('objects').aggregate(pipeline, function (err, data) {
|
||||
@@ -56,9 +56,9 @@ module.exports = function (db, module) {
|
||||
$project: {
|
||||
value: 1,
|
||||
score: {
|
||||
$cond: { if: { $eq: [ "$_key", sets[index] ] }, then: { $multiply: [ '$score', weight ] }, else: '$score' }
|
||||
}
|
||||
}
|
||||
$cond: { if: { $eq: [ "$_key", sets[index] ] }, then: { $multiply: [ '$score', weight ] }, else: '$score' },
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = function (db, module) {
|
||||
var pipeline = [
|
||||
{ $match: { _key: {$in: keys} } },
|
||||
{ $group: { _id: {value: '$value' } } },
|
||||
{ $group: { _id: null, count: { $sum: 1 } } }
|
||||
{ $group: { _id: null, count: { $sum: 1 } } },
|
||||
];
|
||||
|
||||
var project = { _id: 0, count: '$count' };
|
||||
@@ -50,7 +50,7 @@ module.exports = function (db, module) {
|
||||
var pipeline = [
|
||||
{ $match: { _key: {$in: params.sets}} },
|
||||
{ $group: { _id: {value: '$value'}, totalScore: aggregate} },
|
||||
{ $sort: { totalScore: params.sort} }
|
||||
{ $sort: { totalScore: params.sort} },
|
||||
];
|
||||
|
||||
if (params.start) {
|
||||
|
||||
@@ -14,25 +14,25 @@
|
||||
{
|
||||
name: 'redis:host',
|
||||
description: 'Host IP or address of your Redis instance',
|
||||
'default': nconf.get('redis:host') || '127.0.0.1'
|
||||
'default': nconf.get('redis:host') || '127.0.0.1',
|
||||
},
|
||||
{
|
||||
name: 'redis:port',
|
||||
description: 'Host port of your Redis instance',
|
||||
'default': nconf.get('redis:port') || 6379
|
||||
'default': nconf.get('redis:port') || 6379,
|
||||
},
|
||||
{
|
||||
name: 'redis:password',
|
||||
description: 'Password of your Redis database',
|
||||
hidden: true,
|
||||
default: nconf.get('redis:password') || '',
|
||||
before: function (value) { value = value || nconf.get('redis:password') || ''; return value; }
|
||||
before: function (value) { value = value || nconf.get('redis:password') || ''; return value; },
|
||||
},
|
||||
{
|
||||
name: "redis:database",
|
||||
description: "Which database to use (0..n)",
|
||||
'default': nconf.get('redis:database') || 0
|
||||
}
|
||||
'default': nconf.get('redis:database') || 0,
|
||||
},
|
||||
];
|
||||
|
||||
module.init = function (callback) {
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
module.sessionStore = new sessionStore({
|
||||
client: module.client,
|
||||
ttl: ttl
|
||||
ttl: ttl,
|
||||
});
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
|
||||
Reference in New Issue
Block a user