orientechnologies / orientjs

The official fast, lightweight node.js client for OrientDB
http://orientdb.com
Other
326 stars 67 forks source link

list inherited properties? #239

Open creisle opened 7 years ago

creisle commented 7 years ago

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?

wolf4ood commented 7 years ago

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