mod_storage_mongodb/mod_storage_mongodb.lua
changeset 506 0e07810550c8
parent 505 b6d2ac386120
child 507 46f578da4ff0
--- 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 } };