mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
linting, TIL that obj.$key is valid syntax
This commit is contained in:
@@ -110,7 +110,7 @@ module.exports = function(db, module) {
|
|||||||
|
|
||||||
var fields = {_id: 0, value: 1};
|
var fields = {_id: 0, value: 1};
|
||||||
if (withScores) {
|
if (withScores) {
|
||||||
fields['score'] = 1;
|
fields.score = 1;
|
||||||
}
|
}
|
||||||
db.collection('objects').find({_key:key}, {fields: fields})
|
db.collection('objects').find({_key:key}, {fields: fields})
|
||||||
.limit(stop - start + 1)
|
.limit(stop - start + 1)
|
||||||
@@ -165,15 +165,15 @@ module.exports = function(db, module) {
|
|||||||
|
|
||||||
var scoreQuery = {};
|
var scoreQuery = {};
|
||||||
if (min !== -Infinity) {
|
if (min !== -Infinity) {
|
||||||
scoreQuery['$gte'] = min;
|
scoreQuery.$gte = min;
|
||||||
}
|
}
|
||||||
if (max !== Infinity) {
|
if (max !== Infinity) {
|
||||||
scoreQuery['$lte'] = max;
|
scoreQuery.$lte = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fields = {_id: 0, value: 1};
|
var fields = {_id: 0, value: 1};
|
||||||
if (withScores) {
|
if (withScores) {
|
||||||
fields['score'] = 1;
|
fields.score = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
db.collection('objects').find({_key:key, score: scoreQuery}, {fields: fields})
|
db.collection('objects').find({_key:key, score: scoreQuery}, {fields: fields})
|
||||||
@@ -440,7 +440,7 @@ module.exports = function(db, module) {
|
|||||||
}
|
}
|
||||||
var data = {};
|
var data = {};
|
||||||
value = helpers.fieldToString(value);
|
value = helpers.fieldToString(value);
|
||||||
data['score'] = parseInt(increment, 10);
|
data.score = parseInt(increment, 10);
|
||||||
|
|
||||||
db.collection('objects').findAndModify({_key: key, value: value}, {}, {$inc: data}, {new:true, upsert:true}, function(err, result) {
|
db.collection('objects').findAndModify({_key: key, value: value}, {}, {$inc: data}, {new:true, upsert:true}, function(err, result) {
|
||||||
callback(err, result ? result[value] : null);
|
callback(err, result ? result[value] : null);
|
||||||
|
|||||||
@@ -78,7 +78,9 @@
|
|||||||
var redis_socket_or_host = nconf.get('redis:host'),
|
var redis_socket_or_host = nconf.get('redis:host'),
|
||||||
cxn, dbIdx;
|
cxn, dbIdx;
|
||||||
|
|
||||||
if (!redis) redis = require('redis');
|
if (!redis) {
|
||||||
|
redis = require('redis');
|
||||||
|
}
|
||||||
|
|
||||||
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) {
|
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) {
|
||||||
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ var utils = require('./../../public/src/utils'),
|
|||||||
var middleware = {};
|
var middleware = {};
|
||||||
|
|
||||||
function routeCurrentTheme(app, themeId, themesData) {
|
function routeCurrentTheme(app, themeId, themesData) {
|
||||||
var themeId = (themeId || 'nodebb-theme-vanilla'),
|
themeId = (themeId || 'nodebb-theme-vanilla');
|
||||||
themeObj = (function(id) {
|
|
||||||
|
var themeObj = (function(id) {
|
||||||
return themesData.filter(function(themeObj) {
|
return themesData.filter(function(themeObj) {
|
||||||
return themeObj.id === id;
|
return themeObj.id === id;
|
||||||
})[0];
|
})[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user