Diff

mod_storage_mongodb/mod_storage_mongodb.lua @ 506:0e07810550c8

mod_storage_mongodb: Use _global as host when none provided
author James Callahan <james@chatid.com>
date Tue, 13 Dec 2011 12:30:01 +1100
parent 505:b6d2ac386120
child 507:46f578da4ff0
line wrap: on
line diff
--- a/mod_storage_mongodb/mod_storage_mongodb.lua	Mon Dec 12 21:51:29 2011 +1100
+++ b/mod_storage_mongodb/mod_storage_mongodb.lua	Tue Dec 13 12:30:01 2011 +1100
@@ -14,7 +14,8 @@
 keyval_store.__index = keyval_store;
 
 function keyval_store:get(username)
-	local host, store = module.host, self.store;
+	local host = module.host or "_global";
+	local store = self.store;
 
 	local namespace = params.dbname .. "." .. host;
 	local v = { _id = { store = store ; username = username } };
@@ -28,8 +29,8 @@
 end
 
 function keyval_store:set(username, data)
-	local host, store = module.host, self.store;
-	if not host then return nil , "mongodb cannot currently be used for host-less data" end;
+	local host = module.host or "_global";
+	local store = self.store;
 
 	local namespace = params.dbname .. "." .. host;
 	local v = { _id = { store = store ; username = username } };