Search code examples
javascripttypescriptorientdb

Can I link class field to multiple classes in orientdb?


Consider there is one field 'player' of any orientdb class, can we link this field with multiple classes such as Teams, Groups, Users etc. I know we can link this field with single class and in that field we can store @rid of record in link class.


Solution

  • Yes, absolutely, you do it in a schemaless way:

    INSERT INTO AClass SET aLinkProperty = #9:0
    

    But you can also define a schema for the proplerty, without defining the class for the link:

    CREATE PROPERTY AClass.aLinkProperty LINK