{"action":"created","issue":{"url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/18326","repository_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs","labels_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/18326/labels{/name}","comments_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/18326/comments","events_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/18326/events","html_url":"https://github.com/MicrosoftDocs/azure-docs/issues/18326","id":378049192,"node_id":"MDU6SXNzdWUzNzgwNDkxOTI=","number":18326,"title":"Cosmos DB Geospatial input binding not functioning correctly.","user":{"login":"williamdlupo","id":20422211,"node_id":"MDQ6VXNlcjIwNDIyMjEx","avatar_url":"https://avatars2.githubusercontent.com/u/20422211?v=4","gravatar_id":"","url":"https://api.github.com/users/williamdlupo","html_url":"https://github.com/williamdlupo","followers_url":"https://api.github.com/users/williamdlupo/followers","following_url":"https://api.github.com/users/williamdlupo/following{/other_user}","gists_url":"https://api.github.com/users/williamdlupo/gists{/gist_id}","starred_url":"https://api.github.com/users/williamdlupo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/williamdlupo/subscriptions","organizations_url":"https://api.github.com/users/williamdlupo/orgs","repos_url":"https://api.github.com/users/williamdlupo/repos","events_url":"https://api.github.com/users/williamdlupo/events{/privacy}","received_events_url":"https://api.github.com/users/williamdlupo/received_events","type":"User","site_admin":false},"labels":[{"id":1055600147,"node_id":"MDU6TGFiZWwxMDU1NjAwMTQ3","url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/labels/azure-functions;%20cosmos-db/svc","name":"azure-functions; cosmos-db/svc","color":"ededed","default":false},{"id":836703193,"node_id":"MDU6TGFiZWw4MzY3MDMxOTM=","url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/labels/cxp","name":"cxp","color":"bf1394","default":false},{"id":836704904,"node_id":"MDU6TGFiZWw4MzY3MDQ5MDQ=","url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/labels/doc-bug","name":"doc-bug","color":"84edbc","default":false},{"id":836703308,"node_id":"MDU6TGFiZWw4MzY3MDMzMDg=","url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/labels/in-progress","name":"in-progress","color":"c1d9ff","default":false},{"id":836702742,"node_id":"MDU6TGFiZWw4MzY3MDI3NDI=","url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/labels/triaged","name":"triaged","color":"0e8a16","default":false}],"state":"closed","locked":false,"assignee":{"login":"PramodValavala-MSFT","id":43602528,"node_id":"MDQ6VXNlcjQzNjAyNTI4","avatar_url":"https://avatars1.githubusercontent.com/u/43602528?v=4","gravatar_id":"","url":"https://api.github.com/users/PramodValavala-MSFT","html_url":"https://github.com/PramodValavala-MSFT","followers_url":"https://api.github.com/users/PramodValavala-MSFT/followers","following_url":"https://api.github.com/users/PramodValavala-MSFT/following{/other_user}","gists_url":"https://api.github.com/users/PramodValavala-MSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/PramodValavala-MSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PramodValavala-MSFT/subscriptions","organizations_url":"https://api.github.com/users/PramodValavala-MSFT/orgs","repos_url":"https://api.github.com/users/PramodValavala-MSFT/repos","events_url":"https://api.github.com/users/PramodValavala-MSFT/events{/privacy}","received_events_url":"https://api.github.com/users/PramodValavala-MSFT/received_events","type":"User","site_admin":false},"assignees":[{"login":"PramodValavala-MSFT","id":43602528,"node_id":"MDQ6VXNlcjQzNjAyNTI4","avatar_url":"https://avatars1.githubusercontent.com/u/43602528?v=4","gravatar_id":"","url":"https://api.github.com/users/PramodValavala-MSFT","html_url":"https://github.com/PramodValavala-MSFT","followers_url":"https://api.github.com/users/PramodValavala-MSFT/followers","following_url":"https://api.github.com/users/PramodValavala-MSFT/following{/other_user}","gists_url":"https://api.github.com/users/PramodValavala-MSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/PramodValavala-MSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PramodValavala-MSFT/subscriptions","organizations_url":"https://api.github.com/users/PramodValavala-MSFT/orgs","repos_url":"https://api.github.com/users/PramodValavala-MSFT/repos","events_url":"https://api.github.com/users/PramodValavala-MSFT/events{/privacy}","received_events_url":"https://api.github.com/users/PramodValavala-MSFT/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-11-06T21:53:03Z","updated_at":"2018-11-15T15:30:33Z","closed_at":"2018-11-14T12:09:19Z","author_association":"NONE","body":"As the title implies, the CosmosDB functions for querying geospatial data do not return the correct result when the query is specified as a string in the function.json and .csx file. \n\nIt is required to escape the \"{ }\" characters in order to get the function to execute, but decimal coordinates passed in as url parameters are not passed as decimals. \n For example:\nSELECT ST_ISVALID({ \"type\": \"Point\", \"coordinates\": [x, y] }) with valid coordinates returns false. \n\n---\n#### Document Details\n\n⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*\n\n* ID: fa5bcb79-2af8-3b0e-c78c-0c89a2535e15\n* Version Independent ID: 31b87687-7841-f46f-8c97-38898e7b97db\n* Content: [Azure Cosmos DB bindings for Functions 2.x](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2#http-trigger-get-multiple-docs-using-sqlquery-c-script)\n* Content Source: [articles/azure-functions/functions-bindings-cosmosdb-v2.md](https://github.com/Microsoft/azure-docs/blob/master/articles/azure-functions/functions-bindings-cosmosdb-v2.md)\n* Service: **azure-functions; cosmos-db**\n* GitHub Login: @craigshoemaker\n* Microsoft Alias: **cshoe**"},"comment":{"url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/comments/439080490","html_url":"https://github.com/MicrosoftDocs/azure-docs/issues/18326#issuecomment-439080490","issue_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/18326","id":439080490,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTA4MDQ5MA==","user":{"login":"PramodValavala-MSFT","id":43602528,"node_id":"MDQ6VXNlcjQzNjAyNTI4","avatar_url":"https://avatars1.githubusercontent.com/u/43602528?v=4","gravatar_id":"","url":"https://api.github.com/users/PramodValavala-MSFT","html_url":"https://github.com/PramodValavala-MSFT","followers_url":"https://api.github.com/users/PramodValavala-MSFT/followers","following_url":"https://api.github.com/users/PramodValavala-MSFT/following{/other_user}","gists_url":"https://api.github.com/users/PramodValavala-MSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/PramodValavala-MSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PramodValavala-MSFT/subscriptions","organizations_url":"https://api.github.com/users/PramodValavala-MSFT/orgs","repos_url":"https://api.github.com/users/PramodValavala-MSFT/repos","events_url":"https://api.github.com/users/PramodValavala-MSFT/events{/privacy}","received_events_url":"https://api.github.com/users/PramodValavala-MSFT/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T15:30:33Z","updated_at":"2018-11-15T15:30:33Z","author_association":"MEMBER","body":"@williamdlupo While we investigate this issue further, here is a workaround you can try out.\r\n\r\n1. Create a User Defined Function in Cosmos DB with this code\r\n\r\n```js\r\nfunction ConvertToNumber(str){\r\n    return Number(str);\r\n}\r\n```\r\n![image](https://user-images.githubusercontent.com/43602528/48562740-d82b3f80-e918-11e8-8344-724fdb9fc2b9.png)\r\n\r\n2. And use it in your `function.json` like this\r\n\r\n```json\r\n{\r\n  \"bindings\": [\r\n    {\r\n      \"authLevel\": \"anonymous\",\r\n      \"name\": \"req\",\r\n      \"type\": \"httpTrigger\",\r\n      \"direction\": \"in\",\r\n      \"methods\": [\r\n        \"get\",\r\n        \"post\"\r\n      ],\r\n      \"route\": \"at/{x:float}/{y:float}\"\r\n    },\r\n    {\r\n      \"name\": \"$return\",\r\n      \"type\": \"http\",\r\n      \"direction\": \"out\"\r\n    },\r\n    {\r\n      \"type\": \"cosmosDB\",\r\n      \"name\": \"flag\",\r\n      \"databaseName\": \"random\",\r\n      \"collectionName\": \"points\",\r\n      \"connectionStringSetting\": \"<connection-string-setting-name>\",\r\n      \"direction\": \"in\",\r\n      \"sqlQuery\": \"SELECT ST_ISVALID({{ \\\"type\\\": \\\"Point\\\", \\\"coordinates\\\": [udf.ConvertToNumber({x}), udf.ConvertToNumber({y})] }})\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nThis workaround was shared initially on [StackOverflow](https://stackoverflow.com/a/44918767/10417839)."}}
{"actor":{"display_login":"PramodValavala-MSFT"}}