Skip to content

Node.js based forum software built for the modern web

added getObjectKeys for julian :)

Baris Soner Usaklibc1cde38da8d
diff --git a/src/database/mongo.js b/src/database/mongo.js
index 7a1b71c36d..3b653a1693 100644
--- a/src/database/mongo.js
+++ b/src/database/mongo.js
@@ -343,6 +343,20 @@
});
}
+ module.getObjectKeys = function(key, callback) {
+ module.getObject(key, function(err, data) {
+ if(err) {
+ return callback(err);
+ }
+
+ if(data) {
+ callback(null, Object.keys(data));
+ } else {
+ callback(null, []);
+ }
+ });
+ }
+
module.getObjectValues = function(key, callback) {
module.getObject(key, function(err, data) {
if(err) {
diff --git a/src/database/redis.js b/src/database/redis.js
index e8964b7a36..6af259f9ca 100644
--- a/src/database/redis.js
+++ b/src/database/redis.js
@@ -275,6 +275,10 @@
});
}
+ module.getObjectKeys = function(key, callback) {
+ redisClient.hkeys(key, callback);
+ }
+
module.getObjectValues = function(key, callback) {
redisClient.hvals(key, callback);
}