[Developers] multiple create unless_exists in one query
John Giannandrea
jg at metaweb.com
Thu Dec 20 20:47:22 UTC 2007
The problem is quite fundamental to MQL write. If there were two
existing Fredx people, you definitely want MQL to find the one that
had the existing kid, not the other one. Yet the act of writing the
subclause changes the identify of the object that was found in the
prepare phase.
I expect there will be a follow up to this thread in January when Tim
returns from vacation, but for now I think the answer is that you have
to work around this behavior since it is by design.
-jg
On Dec 20, 2007, at 10:31 AM, Arthur van Hoff wrote:
> Hi Alec,
>
> I think you make a good point. However, I still would argue that the
> behavior that is currently implemented is not useful. Take the query
> you
> outlined. In the current implementation it would result in the wrong
> result UNLESS Fred already existed. If Fred does not exist you would
> end
> up with two different Freds, which clearly is not what you intended.
>
> Your example (I had to change the name because Fred already existed):
>
> "query":{
> "id": null,
> "children": {
> "id": null,
> "name": "Fredx's Kid",
> "create": "unless_exists",
> "parents": {
> "id": null,
> "name": "Fredx",
> "create": "unless_exists"
> }
> },
> "name": "Fredx",
> "type": "/people/person",
> "create": "unless_exists"
> }
More information about the Developers
mailing list