mongo posting fix

This commit is contained in:
barisusakli
2014-09-03 19:38:48 -04:00
parent dc9754d77a
commit 10b30e303b
10 changed files with 27 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ module.exports = function(db, module) {
}
], function(err) {
if (typeof callback === 'function') {
callback(err, obj);
callback(err);
}
});
};
@@ -42,7 +42,7 @@ module.exports = function(db, module) {
if (typeof callback === 'function') {
callback(err, obj);
}
});
});
} else {
if (typeof callback === 'function') {
callback(err, {});

View File

@@ -2,7 +2,7 @@
module.exports = function(db, module) {
var helpers = module.helpers.level;
module.listPrepend = function(key, value, callback) {
module.getListRange(key, 0, -1, function(err, list) {
var arr = list || [];
@@ -17,7 +17,7 @@ module.exports = function(db, module) {
arr.push(value);
module.set(key, arr, function(err) {
if (typeof callback === 'function') {
callback(err, list);
callback(err);
}
});
});

View File

@@ -6,13 +6,15 @@ module.exports = function(db, module) {
var helpers = module.helpers.level;
module.setAdd = function(key, value, callback) {
callback = callback || function() {};
module.getListRange(key, 0, -1, function(err, set) {
if (err) {
return callback(err);
}
if (set.indexOf(value) === -1) {
module.listAppend(key, value, callback);
} else {
if (typeof callback === 'function') {
callback(null, []); // verify if it sends back true on redis?
}
callback(null);
}
});
};