3 ms·
You 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
by overcast 10y ago
You 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!