有没有人在OrientDB中有一个JSON插入/选择的工作示例?

时间:2012-05-24 09:59:37

标签: orientdb

选择查询不适用于OrientDB中的JSON。有人可以提供展示两件事的工作示例:

  1. 正确插入JSON数据

  2. 查询JSON数据

  3. 谢谢!

3 个答案:

答案 0 :(得分:4)

1.使用“content”来实现JSON插入。

例如 -
insert into Person content {"name":"nawab","age":25}

要运行此功能,您必须事先配置为 -
1.通过 -

创建一个顶点
create class Person extends V    

2.然后创建属性名称年龄

create property Person.name string
create property Person.age integer

答案 1 :(得分:3)

你走了!我一直试图弄清楚这一段时间,最后让它发挥作用。 :)

运行以下显示的sql命令:

create class EXAMPLE

/* The trick is: Do not 'CREATE' the property with any type */

insert into EXAMPLE (my_prop) values ({"name": "James", "age": 23})
insert into EXAMPLE (my_prop) values ({"name": "Harden", "age": 24})

/* Fetch the fields inside the JSON */
select my_prop.name from example
select my_prop.age from example where my_prop.name like 'James'

我从书中读到了这个例子:Getting Started with OrientDB By Claudio Tesoriero

希望它有所帮助!

答案 2 :(得分:1)

这个问题在OrientDB小组here中继续存在。如果一切正常,你试过吗?

相关问题