I\'m pretty new on Nodejs and sails. I\'m implementing a server which is similiar to Twitter. In user model, there should be 2 fields: follower and following, and the 2 fiel
For such usage your model definition is incorrect, namely the via
keywords. As per the waterline associations docs the via
keyword references the other side of the association. So, for a follower
the other side is following
and vice-versa. In other words:
follower: {
collection: 'user',
via: 'following'
},
following:{
collection: 'user',
via: 'follower'
}
You can check a full working example at: https://github.com/appscot/sails-orientdb/blob/master/test/integration-orientdb/tests/associations/manyToMany.selfReferencing.js