Software /
code /
prosody-modules
Changeset
1010:fd420237a5e4
mod_storage_mongodb: Use util.json to encode our data (handles non-string table keys, etc).
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 09 May 2013 11:23:07 -0400 |
parents | 1009:fcba646eb20a |
children | 1012:c53a1b8a1cfa |
files | mod_storage_mongodb/mod_storage_mongodb.lua |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_storage_mongodb/mod_storage_mongodb.lua Thu May 09 13:37:55 2013 +0200 +++ b/mod_storage_mongodb/mod_storage_mongodb.lua Thu May 09 11:23:07 2013 -0400 @@ -7,6 +7,8 @@ local mongo = require "mongo"; prosody.lock_globals(); +local json = require "util.json"; + local conn local keyval_store = {}; @@ -38,7 +40,7 @@ if next(data) ~= nil then -- set data v.data = data; - return conn:insert ( namespace , v ); + return conn:insert ( namespace , json.encode(v) ); else -- delete data return conn:remove ( namespace , v ); end;