Does sails.js support relationships between models/collections? If so, can someone point to documentation?
For example: I have 2 models
1.Production
production: {
name: 'string',
description: 'text'
}
2.Album
album: {
name: 'string',
productionID: 'ObjectID'// How do I get to "production"?
}
Waterline, the ORM for Sails, does support associations between models/collections. However, support for associations is a work in progress. With that being said, the MySQL and Postgresql support is the furthest along.
You may find the unfinished documentation for waterline v0.10 here:
https://github.com/balderdashy/waterline-docs
Sailsjs
0.9.x
does not support relationships or associations currently.0.10
does have a rough outline of this working.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.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).
Once its installed you can then run
sails -v
and you should get0.10
.Then its just a matter of generating a new sails app with
sails new <appname>