0

I am trying to run simple SQL query in Azure Document DB, here is how document look like:

enter image description here

As you can see I store coordinates as double. Now I attempt to run simple query just to test it SELECT * FROM locations WHERE locations.Latitude.CoordinateStart <= 50.123456 and this is not failing but it return 0 results:

enter image description here

For a little bit I thought well maybe I am wrong because I cannot use such a long decimal due to limitations, but if I change those to integer (multiply by 100 values), my coordinate would be 33644729 and my query would look for <= 50123456. In this case I am still not getting any results in query, getting 0. What is missing here?

EDIT:

Indexing policy looks like this

{
    "indexingMode": "consistent",
    "automatic": true,
    "includedPaths": [
        {
            "path": "/*",
            "indexes": [
                {
                    "kind": "Range",
                    "dataType": "Number",
                    "precision": -1
                },
                {
                    "kind": "Range",
                    "dataType": "String",
                    "precision": -1
                },
                {
                    "kind": "Spatial",
                    "dataType": "Point"
                }
            ]
        }
    ],
    "excludedPaths": [
        {
            "path": "/\"_etag\"/?"
        }
    ]
}

Those are default settings, I haven't touched them upon collection creation.

1
  • 1
    @MartinSmith I have added indexing policy info to this question Commented Jan 9, 2019 at 7:53

1 Answer 1

2

Try this query:

SELECT * FROM locations WHERE locations.Latitude[0].CoordinateStart <= 50.123456
Sign up to request clarification or add additional context in comments.

2 Comments

You were close, your query didn't work, got same results, but this did work: SELECT * FROM locations WHERE locations.Latitude[0].CoordinateStart <= 50.123456
I had a typo in the answer which i fixed almost immediately. You must have seen the answer before the fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.