看来,OrientDB 3.0.4中的控制台应用程序与OrientDB 3.0.2并不向后兼容,以创建具有EMBEDDEDLIST的顶点。
在OrientDB 3.0.4控制台中,以下查询失败:
CREATE VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }]
如何解决此问题? v3.0.4做了哪些更改?在哪里可以找到更新的文档?
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}>
答案 0 :(得分:0)
问题是您已将属性声明为“ 电话”,然后尝试使用名称“ 电话”小写创建顶点与架构不符。 另外,也不需要使用方括号,因此请尝试使用:
CREATE VERTEX Profile SET name = "John", Phone = { "@type":"d", "number" : "212"}