Iam building a node js application and OrientDB as the database. Is there someway to create a model for my vertices in node like we do if were using MongoDB?
For instance, I have a class called Account with propertise name, password and email.
Is it possible to create a model for this in node when using OrientDB and OrientJS as the language driver?
Appreciate any help.
I don't know if I understood it correctly, but this is how to create the class you described:
var OrientDB = require('orientjs');
var server = OrientDB({
host: 'localhost',
port: 2424,
username: '<username>',
password: '<password>'
})
var db = server.use({
name: 'mydb',
username: '<username>',
password: '<password>'
})
db.class.get('Account')
.then(function (MyClass) {
MyClass.property.create([{
name: 'name',
type: 'String'
},{
name: 'password',
type: 'String'
},{
name: 'email',
type: 'String'
}])
.then(function () {
console.log('Properties created')
});
})
server.close();
Hope it helps
Regards