Reputation: 41
It appears that console application in OrientDB 3.0.4 is not backward compatible with OrientDB 3.0.2 for creating Vertex having EMBEDDEDLIST.
Following Query fails in OrientDB 3.0.4 console:
CREATE VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }]
How can I resolve the issue? What are the changes for v3.0.4 and where can I find updated documentation?
OrientDB console v.3.0.2 - Veloce (build e47e693f1470a7a642461be26983d4eca70777fd, branch develop) https://www.orientdb.com Type 'help' to display all the supported commands. orientdb> create database remote:localhost/mydb root orientdb Creating database [remote:localhost/mydb] using the storage type [PLOCAL]... Database created successfully. Current database is: remote:localhost/mydb orientdb {db=mydb}> create class Phone EXTENDS V Class created successfully. orientdb {db=mydb}> create property Phone.number String Property created successfully. orientdb {db=mydb}> create class Profile EXTENDS V Class created successfully. orientdb {db=mydb}> create property Profile.name String Property created successfully. orientdb {db=mydb}> create property Profile.phone embeddedList Phone Property created successfully. orientdb {db=mydb}> CREATE VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }] Created vertex '[Profile#33:0{name:John,phone:[1]} v1]' in 0.023000 sec(s). -------
OrientDB console v.3.0.4 - Veloce (build 4578b51f72a55feaa0852bc8ddd52929011d956c, branch 3.0.x) https://www.orientdb.com Type 'help' to display all the supported commands. orientdb> create database remote:localhost/mydb root orientdb Creating database [remote:localhost/mydb] using the storage type [PLOCAL]... Database created successfully. Current database is: remote:localhost/mydb orientdb {db=mydb}> create class Phone EXTENDS V Class created successfully. orientdb {db=mydb}> create property Phone.number String Property created successfully. orientdb {db=mydb}> create class Profile EXTENDS V Class created successfully. orientdb {db=mydb}> create property Profile.name String Property created successfully. orientdb {db=mydb}> create property Profile.phone embeddedList Phone Property created successfully. orientdb {db=mydb}> CREATE VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }] Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query: create VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" } ^ Encountered " "[" "[ "" at line 1, column 50. Was expecting one of: ... ... ... "{" ... ... ... ... "{" ... "{" ... ... ... ... "{" ... "{" ... "{" ... ... ... ... "{" ... "{" ... ... ... ... "{" ... "{" ... ... ... ... "{" ... "{" ... "{" ... DB name="mydb" Error Code="1" DB name="mydb" !Unrecognized command: ']' orientdb {db=mydb}>
Upvotes: 0
Views: 170
Reputation: 371
The issue is that you've declared your property as "Phone" and then you're trying to create your vertex using the name "phone" in lowercase which doesn't match the schema. Also there's no need to use square brackets so instead of that last query, try using:
CREATE VERTEX Profile SET name = "John", Phone = { "@type":"d", "number" : "212"}
Upvotes: 0