added key methods to mongo

v1.18.x
Baris Soner Usakli 11 years ago
parent 113cb85c46
commit ca01fb9f7d

@ -55,19 +55,21 @@
// key
module.exists = function(key, callback) {
throw new Error('not-implemented');
module.isObjectField('global', key, callback);
}
module.delete = function(key, callback) {
throw new Error('not-implemented');
module.deleteObjectField('global', key, callback);
}
module.get = function(key, callback) {
throw new Error('not-implemented');
module.getObjectField('global', key, callback);
}
module.set = function(key, value, callback) {
throw new Error('not-implemented');
var data = {};
data[key] = value;
module.setObject('global', data, callback);
}
module.keys = function(key, callback) {
@ -238,6 +240,7 @@
throw new Error('not-implemented');
}
// sorted sets
module.sortedSetAdd = function(key, score, value, callback) {
@ -352,9 +355,9 @@
return callback(err);
}
if(data && data.array) {
callback(err, data.array);
callback(null, data.array);
} else {
callback(err, []);
callback(null, []);
}
});
}

@ -204,6 +204,34 @@ var DebugRoute = function(app) {
});
}
function get(callback) {
db.get('testingStr', function(err, data) {
console.log('get return', data);
callback(err, {'get': data});
});
}
function set(callback) {
db.set('testingStr', 'opppa gangastayla', function(err, data) {
console.log('set return', data);
callback(err, {'set': data});
});
}
function deleteKey(callback) {
db.delete('testingStr', function(err, data) {
console.log('delete return', data);
callback(err, {'delete': data});
});
}
function exists(callback) {
db.exists('testingStr', function(err, data) {
console.log('exists return', data);
callback(err, {'exists': data});
});
}
var objectTasks = [
//createUser,
@ -239,7 +267,17 @@ var DebugRoute = function(app) {
getListRange
];
require('async').series(listTasks, function(err, results) {
var keyTasks = [
get,
set,
get,
exists,
deleteKey,
get,
exists
];
require('async').series(keyTasks, function(err, results) {
if(err) {
console.log(err);
res.send(err.message);

Loading…
Cancel
Save