sails js 数据关系 [英] sails js data relationship
问题描述
sails.js 是否支持模型/集合之间的关系?如果是这样,有人可以指出文档吗?
Does sails.js support relationships between models/collections? If so, can someone point to documentation?
例如:我有 2 个模型
For example: I have 2 models
1.生产
production: {
name: 'string',
description: 'text'
}
2.专辑
album: {
name: 'string',
productionID: 'ObjectID'// How do I get to "production"?
}
推荐答案
Sailsjs 0.9.x
目前不支持关系或关联.0.10
确实对这项工作有一个粗略的概述.
Sailsjs 0.9.x
does not support relationships or associations currently. 0.10
does have a rough outline of this working.
免责声明:0.10
分支是一项持续进行中的工作,每天都会随着贡献者向其推送代码而中断,如果出现问题最好询问在 irc #sailsjs 聊天或发布标记为 0.10 的问题(如果它确实已损坏).
Disclaimer: the 0.10
branch is a constant work in progress and can break on a daily basis as the contributors push code to it, if somethings broken its best to ask in the irc #sailsjs chat or post an issue tagged 0.10 if it truly is broken.
您可以安装sailsjs v0.10,通过执行以下操作来尝试一下..(我不在我的机器前进行测试,但它应该可以工作).
You can install sailsjs v0.10 to give it a try by doing something like the following.. (I'm not in front of my machine to test this but it should work).
#in your downloads directory or somewhere globally accessible clone the 0.10 branch
git clone https://github.com/balderdashy/sails -b v0.10 sails;
cd sails; npm install; npm link;
#this will install all sails dependencies, and npm link sails to that cloned folder
安装后,您可以运行 sails -v
,您应该得到 0.10
.
Once its installed you can then run sails -v
and you should get 0.10
.
然后只需使用 sails new
这篇关于sails js 数据关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!