mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-13 21:21:58 +02:00
ESlint comma-dangle
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user