mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-31 19:15:58 +01:00
store id as int
This commit is contained in:
@@ -7,6 +7,10 @@ module.exports = function(db, module) {
|
||||
|
||||
module.searchIndex = function(key, data, id, callback) {
|
||||
callback = callback || function() {};
|
||||
id = parseInt(id, 10);
|
||||
if (!id) {
|
||||
return callback();
|
||||
}
|
||||
var setData = {
|
||||
id: id
|
||||
};
|
||||
@@ -17,7 +21,7 @@ module.exports = function(db, module) {
|
||||
}
|
||||
|
||||
db.collection('search' + key).update({id: id}, {$set: setData}, {upsert:true, w: 1}, function(err) {
|
||||
if(err) {
|
||||
if (err) {
|
||||
winston.error('Error indexing ' + err.message);
|
||||
}
|
||||
callback(err);
|
||||
@@ -66,9 +70,11 @@ module.exports = function(db, module) {
|
||||
|
||||
module.searchRemove = function(key, id, callback) {
|
||||
callback = callback || helpers.noop;
|
||||
id = parseInt(id, 10);
|
||||
if (!id) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
db.collection('search' + key).remove({id: id}, function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user