For embedded documents, the insert and update statements are different.
While insert copes with a plain quasi-JSON object (single-quotes suffice,
not necessarily double-quotes, thus quasi-JSON), does update not work with
this plain JSON type. The additional specs @class and @type must be added.
The following statements can be used to illustrate the issue:
create class Address
create property Address.street String
create property Address.city String
create class Client
create property Client.name String
create property Client.phones embeddedSet String
create property Client.addresses embeddedList Address
insert into client set name = 'James Bond', phones = ['1234', '34567'],
addresses = [{'city':'Shanghai', 'zip':'3999'}, {'city':'New York',
'street':'57th Ave'}]
update client add addresses = [{'city':'London', 'zip':'67373'}] # not
working
update client add addresses =
[{'@type':'d','@class':'Address','city':'London', 'zip':'67373'}] # works
BTW: how to remove or update one or multiple elements in the embedded
collection, say how to update the city of Shanghai, and how to remove city
of New York for the record?
--
---
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.