[Developers] multiple create unless_exists in one query

Arthur van Hoff AVH at zing.net
Thu Dec 20 07:01:38 UTC 2007


Hi,

 

I wrote a query that created multiple reference to the same object using
"create":"unless_exists".

Unfortunately, the object did not yet exist, so to my surprise it
created multiple objects, not just one.

Had the object already existed, the right thing would have happened. Is
that a feature or a bug?

 

Here is a simple example:

 

"query":{

    "foobar": [{

        "name": "bar1",

        "type": "/user/avh/default_domain/bar",

        "create": "unless_exists"

    },{

        "name": "bar1",

        "type": "/user/avh/default_domain/bar",

        "create": "unless_exists"

    }],

    "create": "unless_exists",

    "type": "/user/avh/default_domain/foo",

    "name": "foo1"

}

 

The result is:

 

{

  "status": "200 OK", 

  "code": "/api/status/ok", 

  "result": {

    "foobar": [

      {

        "create": "created", 

        "type": "/user/avh/default_domain/bar", 

        "name": "bar1"

      }, 

      {

        "create": "created", 

        "type": "/user/avh/default_domain/bar", 

        "name": "bar1"

      }

    ], 

    "create": "created", 

    "type": "/user/avh/default_domain/foo", 

    "name": "foo1"

  }

}

 

I expected this to result in one "bar1", but surprisingly I got two.

I am not sure how to work around this.

                                            

Have fun,

 

    Arthur van Hoff

 

___________________________________________

Arthur van Hoff, Dell-ZING, CTO Software and Services.

W: 650-267-2413, F: 650-267-2498, M: 650-283-0842

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20071219/e6eff60f/attachment.htm 


More information about the Developers mailing list