3
votes

I have a class etest1 with properties name and text. Then I have a class etest2 with properties lala and etest (the embedded etest1). But I am not able to insert anything.

If I do:

insert into etest2 content {"lala" : "test lala", etest : {"name" : "das", "text" : "dasd"}}

I get an exception: The field 'etest2.etest' has been declared as EMBEDDED but an incompatible type is used. Value: {name=das, text=dasd}

If I do:

insert into etest2 content {"lala" : "test lala", etest : "#17:10"}

I get another exception: The field 'etest2.etest' has been declared as EMBEDDED but the value is the RecordID #17:10

So how can I insert a embedded document. If it is somehow possible I would like something like the first method I tried. I would like more doing just one insert instead of two inserts.

1

1 Answers

3
votes

If this is your situation:

create class etest1
create property etest1.name string
create property etest1.text string   

create class etest2
create property etest2.lala string
create property etest2.etest embedded etest1

you can do:

insert into etest2 content {"lala" : "test lala", etest : {"@type":"d", "@class":"etest1", "name" : "das", "text" : "dasd"}}