obelisk21 / prosody-modules

Automatically exported from code.google.com/p/prosody-modules
MIT License
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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