3 ms·
While thinky is great and does a ton of heavy lifting for me, I've found it a little bit confusing when needing to write more advanced queries. I would personal
by cjhveal 10y ago
While thinky is great and does a ton of heavy lifting for me, I've found it a little bit confusing when needing to write more advanced queries. I would personally recommend to start learning reql + rethinkdb with the rethinkdbdash[0] driver first. It helps with managing connection pools and working with Promises but still lets you play nice with the (very good) rethinkdb docs while ramping up.
[0]: https://github.com/neumino/rethinkdbdash https://github.com/neumino/rethinkdbdash
- tracker1 10y agoMostly agree with ORMs in general, I find in JS they don't offer nearly as much as simple transforms against the direct objects, though they do provide schema integrity that nosql/document data stores tend to skip over.
- chrisfosterelli 10y agoWe had this experience as well. We started using Thinky for a few projects, but found that as soon as we need more complex queries it became very awkward to work within Thinky to do those. Eventually, we discovered ReQL by itself is just great to work with (especially with rethinkdbdash). Writing your own queries also has significant atomicity benefits over Thinky.
- overcast 10y agoYou can mix and match your own queries with Thinky helper functions. I do it all the time with .getJoin. Do some more advanced REQL query, getJoin it into your other Thinky defined models. Thinky is great for the modeling/relationship aspect, setting up default values based on returns from anonymous js functions, ensuring indexes, and dealing with referential integrities when you want to recursively delete related documents. Managing all of that manually, while it's doable, would be a giant pain in the ass. Point is, Thinky and raw REQL work together.
- chrisfosterelli 10y agoIt's really not that bad to manage that manually! The models we replaced with Joi validators, the relationships we weren't using anyway anymore because Thinky has some limitations to them, default values are easy in Rethink, index management just became part of normal migrations, and referential integrities aren't actually guaranteed in Thinky since it's not atomic so we found explicit chained promises to be more intuitive :) Thinky and raw ReQL definitely work together, don't get me wrong! But as our project scaled we found 95% of our code had become raw ReQL for atomicity, performance, and relational reasons, so it just didn't make sense to use Thinky in future projects. Our original RethinkDB project still contains Thinky, but it'd be cleaner if we just made a complete switch at this point too. To each their own though, of course!