joewalker/prosody-modules

[mod_storage_mongodb] set/get needs json.encode and json.decode

Opened this issue · 2 comments

Thanks for the Mongodb storage. It looks like we need to json encode and json 
decode in mongodb storage setter and getter functions.

I found error when adding a user to the roster, since the data type is table 
and it needs to be json encode before insert into mongodb or else db insert 
fails and server crash's.

Thanks

Original issue reported on code.google.com by sandeep...@gmail.com on 21 Dec 2011 at 5:01

luamongo converts data to BSON for us.
What is the error you get?

Original comment by ja...@chatid.com on 22 Dec 2011 at 12:00

When adding user to roster(Friend add) the user is not adding and server 
hangs(the process stops here). I know luamongo has to convert but when data has 
multiple tables, table within table then luamongo fails to insert, when i add 
json.encode() from prosody utils, then the data is inserted properly in mongodb.

Ex: 
{"demo@example.com":{"groups":{},"subscription":"none"},"__hash":[false,{"versio
n":1}]}

No error, the process just ends at this stage, need to restart the prosody. 

Facing same issue with get as well. Let me know if you need more input. 
Learning lua slowly.

Original comment by sandeep...@gmail.com on 22 Dec 2011 at 8:07