0

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.

Amin Baig
  • 411
  • 4
  • 26

1 Answers1

0

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

Michela Bonizzi
  • 2,622
  • 1
  • 9
  • 16
  • hi, thank you for your reply, OrientDB support is very scare. could you possibly help with another question: https://stackoverflow.com/questions/49722974/nothing-returned-when-deserializing-user-in-node-and-passport – Amin Baig Sep 07 '18 at 06:53