Is there a bettery way to work with nested(associated) models in Sails JS?

前端 未结 2 866
忘掉有多难
忘掉有多难 2021-01-17 03:43

I\'ve connected my SailsJs app to a Mongodb database. I\'m working on an analytic application. These are the major models in my application:

User

相关标签:
2条回答
  • 2021-01-17 04:42

    Right now there is a hook that allows you to do that. It is changing waterline with Offshore. Offshore is extended fork of Waterline with deep populate, cache mechanism.

    sails-hook-orm-offshore

    In the road map right now there are:

    • Associations Criteria (add default criteria to association)
    • Transactions
    0 讨论(0)
  • 2021-01-17 04:46

    At the moment sails doesn't have any kind of nested population. The issue to reference: https://github.com/balderdashy/waterline/issues/308

    Worth saying there's a pull request to add nested population: https://github.com/balderdashy/waterline/pull/1052

    Pull request isn't merged at the moment but you can use it installing one directly with

    npm i Atlantis-Software/waterline#deepPopulate
    

    With it you can do something like .populate('projects.reports ...)'.

    0 讨论(0)
提交回复
热议问题