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

v1 updateContext APPEND doesn't update geo:point locations #2770

Closed
fgalan opened this issue Dec 19, 2016 · 1 comment
Closed

v1 updateContext APPEND doesn't update geo:point locations #2770

fgalan opened this issue Dec 19, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented Dec 19, 2016

Create an entity with geo:point:

curl -vvvv localhost:1026/v2/entities -X POST -H 'Content-Type: application/json' -d @- <<EOF
{
  "id": "line1",
  "type": "bus",
  "loc": {
    "type": "geo:point",
    "value": "36.12,-4.33"
  }
}
EOF

All is ok at DB (pay attention to location field):

> db.entities.findOne()
{
	"_id" : {
		"id" : "line1",
		"type" : "bus",
		"servicePath" : "/"
	},
	"attrNames" : [
		"loc"
	],
	"attrs" : {
		"loc" : {
			"type" : "geo:point",
			"creDate" : 1482139824,
			"modDate" : 1482139824,
			"value" : "36.12,-4.33",
			"mdNames" : [ ]
		}
	},
	"creDate" : 1482139824,
	"modDate" : 1482139824,
	"location" : {
		"attrName" : "loc",
		"coords" : {
			"type" : "Point",
			"coordinates" : [
				-4.33,
				36.12
			]
		}
	}
}

Update entity using v1 updateContext APPEND:

(curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
    "contextElements": [
        {
            "type": "bus",
            "isPattern": "false",
            "id": "line1",
            "attributes": [
                {
                    "name": "loc",
                    "type": "geo:point",
                    "value": "22.33,-11.12"
                }
            ]
        }
    ],
    "updateAction": "APPEND"
} 
EOF

In the DB we can see that the CB updates correctly the attribute value but not the location field:

> db.entities.findOne()
{
	"_id" : {
		"id" : "line1",
		"type" : "bus",
		"servicePath" : "/"
	},
	"attrNames" : [
		"loc"
	],
	"attrs" : {
		"loc" : {
			"value" : "22.33,-11.12",
			"type" : "geo:point",
			"mdNames" : [ ],
			"creDate" : 1482140980,
			"modDate" : 1482141000
		}
	},
	"creDate" : 1482140980,
	"modDate" : 1482141000,
	"location" : {
		"attrName" : "loc",
		"coords" : {
			"type" : "Point",
			"coordinates" : [
				-4.33,
				36.12
			]
		}
	}
}

CC: @gtorodelvalle , @frbattid

@fgalan
Copy link
Member Author

fgalan commented Jan 2, 2017

Fixed by PR #2792

@fgalan fgalan closed this as completed Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant