After some experimentation I was able to answer my own question. First, for
embedded{list|set|map} fields, it seems that a schema is required - type
embedded{list|set|map} with link type embedded. It also appears that most
of the type the "@type":"d" field is required otherwise it does not always
work. So lets say you have a class Test with fields eset (embeddedset),
elist (embeddedlist), emap (embeddedmap). Then the following appears to
work (assume the document #14:14 exists but all of the fields are null):
update #14:14 set elist = [{"@type":"d","f1":"v1"}]
update #14:14 add elist = [{"@type":"d","f1":"v2"}] // must pass list [..]
otherwise OSerializationException: Expected a record but was null
update #14:14 set eset = [{"@type":"d","f1":"v3"}]
update #14:14 add eset = [{"@type":"d","f1":"v4"}] // must pass list [..]
otherwise OSerializationException: Expected a record but was null
update #14:14 set emap = {"k1": {"@type":"d","f1":"v5"}, "k2":
{"@type":"d","f1":"v6"}]
On Wednesday, September 3, 2014 12:31:46 PM UTC-4, Jon Fields wrote:
>
> Insert a document with a single property with an embedded list containing
> one document:
>
> insert into Test set prop1 = [{"f1":"v1"}]
> Inserted record 'Test#14:4{prop1:[1]} v10' in 0.003000 sec(s).
>
> Verify:
>
> select expand(prop1) from #14:4
> ----+------+-------
> # |@RID |value
> ----+------+-------
> 0 |#-1:-1|{f1=v1}
> ----+------+-------
>
>
> Now I want to add another document to the embedded set:
>
> update #14:4 add prop1 = {"f2":"v2"}
> Updated record(s) '1' in 0.004000 sec(s).
>
>
> However:
>
> select expand(prop1) from #14:4
>
> ----+------+-------
> # |@RID |value
> ----+------+-------
> 0 |#-1:-1|{f1=v1}
> 1 |#-1:-1|v2
> ----+------+-------
>
>
> I would have expected {f2=v2} for the second value of prop1.
>
> What am I doing wrong? Or is this a bug?
>
> Thanks.
>
>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.