orientjs icon indicating copy to clipboard operation
orientjs copied to clipboard

list inherited properties?

Open creisle opened this issue 7 years ago • 1 comments

orientjs version: 2.2.3 orientdb version: 2.2.17 OS: centos06

Is there a way to get the inherited properties for a class? When I try to list the properties of a class I only get the immediate properties

for example

const OrientDB  = require('orientjs');

const serverConf = {
    host: 'localhost',
    HTTPport: 2480,
    username: 'root',
    password: 'root'
};
// set up the database server
const server = OrientDB(serverConf);

// create the test db
server.create({name: 'test', username: 'admin', password: 'admin'})
    .then((db) => {
        // make the first class
        db.class.create('parent', 'V')
            .then((parent) => {
                console.log('created parent:', parent.name);
                // create a property
                parent.property.create({name: 'prop1', type: 'string'})
                    .then(() => {
                        // create the subclass
                        return db.class.create('child', 'parent');
                    }).then((child) => {
                        // check if the child has the parent property
                        console.log(child.properties);
                    })
            })
    })

will give me

created parent: parent
[]

I would have expected (hoped?) to get something like

created parent: parent
[{name: "prop1",....}]

is there a way to do that?

creisle avatar Mar 31 '17 00:03 creisle

hi @creisle

i think there is no way. OrientJS uses this api to get the schema

select from metadata:schema

if you execute this you will se that the properties are flat I can mark this as enhancement, but it's more related to OrientDB than Orientjs

wolf4ood avatar Mar 31 '17 09:03 wolf4ood