Proper way to store JSON data under a user?
-
Is there a proper way to store JSON data under a user in the database (via the UID), and if so what would be the best way to retrieve such?
-
Is this a plugin? It's best for you to store it under a
plugin:myplugin:<uid>
hash. This way you don't pollute the core user hash with things in case the admin removes the plugin and uses something else which might even have that same field.We don't have any restrictions on that at the moment, but this makes me realize we should write a "best practices" doc for plugins.
-
Plugin. Thanks! And yeah, that would be super helpful!
-
So basically you can use
db.setObject
your object instead of JSON.stringify, thendb.getObject
to retrieve. Hopefully straightforward -
@psychobunny Perfect! I sent you a PM regarding such.