What will be the LINQ equivalent of this cosmos SQL API query:
SELECT c as Person, ST_DISTANCE(c.location, {'type': 'Point', 'coordinates':[-122.3382419, 47.6074856]}) as Distance
FROM c
WHERE c.DocType = 0 AND
ST_DISTANCE(c.location, {'type': 'Point', 'coordinates':[-123.3382419, 47.6074856]}) < 1 AND NOT c.Blocked
which gets back
[
{
"Person": {
"DocType": 0,
"location": {
"type": "Point",
"coordinates": [
-123.3382419,
47.6074856
]
},
"MDS": "Chwal",
"Description": "Bduwhs",
"Contents": null,
"GFree": false,
"Veg": false,
"AllergicContents": null,
"Calorie": 0,
"LinkToRecipe": null,
"Cost": 36,
"DASD": "Mexican",
"ExpirationTime": "2019-12-17T11:30:52Z",
"Images": [
"test/25254932-2898-5fd7-949b-b2feb25a4964"
],
"ProducerUserId": "1b36c0f1-425c-483a-bb01-69b06e69f203",
"ExchangeDateTimeStartInUtc": "2019-12-17T20:30:52Z",
"ExchangeDateTimeEndInUtc": "2019-12-17T19:30:52Z",
"Blocked": false,
"id": "asd,
"_rid": "asd=="
},
"Distance": 0.1
}
]
The problem with ST_DISTANCE is that it can only be calculated on Cosmos db, and can't be post evaluated.
ST_DISTANCE
is not supported in cosmos db linq according to this MS doc:docs.microsoft.com/en-us/azure/cosmos-db/sql-query-linq-to-sql – Jay Gong