zuboje
zuboje

Reputation: 726

Document DB and SQL operators

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.

Upvotes: 0

Views: 34

Answers (1)

Nick Chapsas
Nick Chapsas

Reputation: 7200

Try this query:

SELECT * FROM locations WHERE locations.Latitude[0].CoordinateStart <= 50.123456

Upvotes: 2

Related Questions