Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] we can update multiples entities in update by ID #1198

Closed
iariasleon opened this issue Sep 1, 2015 · 3 comments
Closed

[BUG] we can update multiples entities in update by ID #1198

iariasleon opened this issue Sep 1, 2015 · 3 comments
Assignees
Milestone

Comments

@iariasleon
Copy link
Contributor

We have two entities with the same entity_id:
ex:

POST http://<host>:<port>/v2/entities
Fiware-Service: happy_path
Fiware-ServicePath: /test
{"type":"room_1", "id": "room_10", "my_attr": "34"}
POST http://<host>:<port>/v2/entities
Fiware-Service: happy_path
Fiware-ServicePath: /test
{"type":"room_2", "id": "room_10", "attr_test": "45"}

And try to update an entity by ID

POST http://<host>:<port>/v2/entities/room_10
Fiware-Service: happy_path
Fiware-ServicePath: /test
{"new_attr": "14"}

Both entities are updated:
ex in mongo:

{ "_id" : { "id" : "room_10", "type" : "room_1", "servicePath" : "/test" }, "attrNames" : [ "my_attr", "new_attr" ], "attrs" : { "my_attr" : { "type" : "", "creDate" : 1441095072, "modDate" : 1441095072, "value" : "34" }, "new_attr" : { "value" : "14", "type" : "", "creDate" : 1441095097, "modDate" : 1441095097 } }, "creDate" : 1441095072, "modDate" : 1441095097 }
{ "_id" : { "id" : "room_10", "type" : "room_2", "servicePath" : "/test" }, "attrNames" : [ "attr_test", "new_attr" ], "attrs" : { "attr_test" : { "type" : "", "creDate" : 1441095085, "modDate" : 1441095085, "value" : "45" }, "new_attr" : { "value" : "14", "type" : "", "creDate" : 1441095097, "modDate" : 1441095097 } }, "creDate" : 1441095085, "modDate" : 1441095097 }

In this case the response expected:
Status: 409 Conflict

{
error: "TooManyResults"
description: "There is more than one entity with that id. Refine your query."
}
@iariasleon iariasleon added this to the 0.24.0 milestone Sep 1, 2015
@fgalan fgalan modified the milestones: 0.24.0, 0.25.0 Sep 8, 2015
@fgalan
Copy link
Member

fgalan commented Sep 15, 2015

Due to mongoBackend implications, @fgalan could be the best candidate for assigning this.

@fgalan
Copy link
Member

fgalan commented Sep 17, 2015

Fixed in PR #1240. @iariasleon please hava a look and close the issue if you find it solved.

@fgalan fgalan assigned iariasleon and unassigned fgalan Sep 17, 2015
@iariasleon
Copy link
Contributor Author

LGTM

{"error":"TooManyResults","description":"There is more than one entity that match the update. Please refine your query."}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants