5 ms·
I am developing a mobile game and the BaaS we use (Gamesparks) uses MongoDB. Currently I use SQLite to cache the data locally, but that can be a pain to transfo
by fnayr 9y ago
I am developing a mobile game and the BaaS we use (Gamesparks) uses MongoDB. Currently I use SQLite to cache the data locally, but that can be a pain to transform document formatted data to relational, and back. I wish I had known about this before (and I use Unity so the app code is C#).
- infogulch 9y agoSQLite can work as a document store too. Data can be any type (in spite of defined column types), and it works even for pretty big document sizes.
- fnayr 9y agoInteresting, I did not know that. However, I use a 3rd party framework to transform the table rows to classes, and I assume I would lose all that magic conversion. In other words, the reason I go through all the effort of transforming to relational is for querying and updating, but if I just put the raw document in there, I won't have granularity on my querying (I imagine).
- rakoo 9y agoYou can store everything in JSON in SQLite and then query it using json functions (https://www.sqlite.org/json1.html https://www.sqlite.org/json1.html) or even combine than with indexes on expressions (https://sqlite.org/expridx.html https://sqlite.org/expridx.html) if you have a good indexable property
- fnayr 9y agoOk this is pretty cool. This is also why I love HN. I've been using SQLite for ~3 years, have I missed this from the beginning or has it been added since then?
- lotyrin 9y agoProbably wasn't available at that time. From the VCS history, looks like it was very first started on 2015-08-12, not sure when it became stable or part of a release.
- ioddly 9y agoIt's definitely only about two years old. I remember commenting on it when someone submitted the repo timeline relating to JSON on HN.