Closed tommykennedy closed 9 years ago
Hello @tommykennedy, do you get the same with OrientDB 2.0.x? Sails-orientDB does not support OrientDB 2.1 yet, check #52.
No I checked it on 2.0.5-snapshot and it also came up with the error. Is there a problem with passing in a Javascript Object to the create method? Is it expecting a string?
Is there a problem with passing in a Javascript Object to the create method?
There shouldn't be as sails-orientdb passes the json type test which is not too different from what you are doing. Is this schemaful or schemaless btw?
The Answer model is defined as
module.exports = {
tableName: 'Answer',
identity: 'Answer',
attributes: {
id: {
type: 'string',
primaryKey: true,
columnName: '@rid'
},
Answer: {
type: 'JSON'
},
question: {
collection: 'Questions',
via: 'answers',
}
}
};
so I would say Schemaful if my understanding is correct.
BTW, this is probably not the cause of your issue but the identity
(and collection
) of a model must be lower case: docs
I commented out the identity tags and that didn't make a difference. I have attached both models. They are joined by an edge relationship. I think this is where the issue lies.
Found class name null or empty is still coming up and the edge does not get created.
Answer
module.exports = {
tableName: 'Answer',
//identity: 'answer',
attributes: {
id: {
type: 'string',
primaryKey: true,
columnName: '@rid'
},
Answer: {
type: 'JSON'
},
question: {
collection: 'questions',
via: 'answers',
}
}
};
and Question
module.exports = {
tableName: 'Questions',
//identity:'questions',
joinTableNames: {
answers: 'answered'
},
attributes: {
id: { type: 'string', primaryKey: true, columnName: '@rid'},
question : { type: 'string'},
answers: {
collection: 'answer',
via: 'question',
dominant:true
}
}
};
I enabled Oriento Logging and the output gives.
executing query against db waterlineTest: INSERT INTO Answer SET Answer = :paramAnswer0, createdAt = :paramcreatedAt1, updatedAt = :paramupdatedAt2 sending operation command for database waterlineTest executing query against db waterlineTest: UPDATE Answer SET Answer = :paramAnswer0, createdAt = :paramcreatedAt1, updatedAt = :paramupdatedAt2, @rid = :paramrid3 RETURN AFTER WHERE @rid = :param0 sending operation command for database waterlineTest
@tommykennedy, would you mind submitting a PR with a test? You can use 105-delete_customPK.js as a template.
I haven't written any tests before but now is the time to learn. Let me look at the template and attempt it. Are there any docs?
Hi Dario,
I have submitted a failing test.
Tom
Fixed via #119.
Hi Dario,
I am running the following code below on sails-orientdb v0.10.55. I get the error below. I have played around with the answer variable and the length of the object name seems to cause it. The Answer parameter is of type JSON.
OrientDB Server v2.1-rc4 Oriento 1.1.3
Any ideas?
Tom
Error (E_UNKNOWN) :: Encountered an unexpected error
OrientDB.RequestError: Found class name null or empty
From previous event:
From previous event:
From previous event:
From previous event:
Details: OrientDB.RequestError: Found class name null or empty