Reputation: 1267
With orientDB you can insert / update directly using JSON as the input using the 'CONTENT' keyword which is great. ODB takes care of the mappings.
Id like to be able to return JSON as well from SELECT queries - is this possible?
Kurt
Upvotes: 2
Views: 1235
Reputation: 1369
You can use .toJSON()
method.
Syntax: <value>.toJSON([<format>])
Example:
create class Test extends V
insert into Test content {"attr1": "value 1", "attr2": "value 2"}
select @this.toJson('rid,version,fetchPlan:in_*:-2 out_*:-2') from Test
Ref.: SQL Methods - .toJSON()
Upvotes: 3