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

守給你的承諾、 提交于 2019-12-01 14:07:27

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 ...)'.

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!