I have two models declared in Sails and I'm using the Waterline-Orientdb adapter and don't know how to connect them via a bi-directional edge
Questions Model
var Waterline = require('waterline');
module.exports = Waterline.Collection.extend({
tableName: 'questionsTable',
identity: 'questions',
connection: 'associations',
attributes: {
id: { type: 'string', primaryKey: true, columnName: '@rid'},
question : { type: 'string'},
user: { model: "User", required: true },
answerOptions: {type: 'json'},
imagefile: {type:'string'},
answers: {
collection: 'answer',
via: 'questions',
dominant:true
}
}
});
Answer Model
var Waterline = require('waterline');
module.exports = Waterline.Collection.extend({
tableName: 'answerTable',
identity: 'answer',
connection: 'associations',
attributes: {
id: {
type: 'string',
primaryKey: true,
columnName: '@rid'
},
Answer: {
type: 'string'
},
questions: {
collection: 'questions',
via: 'answer'
}
}
});
I want to be able to create an edge between the two models. The user creates a question and then users can post a response.