Google Groups

Re: C# Querying with distance help

Ali Khan Apr 27, 2012 9:35 AM
Posted in group: mongodb-user
What is the default passing in valude, i.e would 50 be miles or kilometers? How do I set it to miles?

On Thursday, April 26, 2012 5:33:49 PM UTC+1, Ali wrote:
Hi I am using the 10gen Driver for c# 1.4.1 with Linq.

I have a query that finds multiple criteria from IQueryable as
var result = col.asquerable();
result = result.where(cond1);
result = result.where(cond3) etc to filter down the results;

What I would like is the final search before i show the results to be
less than a distance i specify.  I have lon/lat stored in the
collection as location:{long,lat}

i want to pass in the current users long/lat which i have as two vars
already plus the distance they wish to search below i.e < 30 miles.

How can I create this a one query, i would be happy to do it without
linq if need be and use the raw way of building the query.

Thanks in advance.