Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8980649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:08:25+00:00 2026-06-15T20:08:25+00:00

I am doing spatial queries in Mongo. I need to find all venues within

  • 0

I am doing spatial queries in Mongo. I need to find all venues within 10 miles of San Francisco. From the command line, I am getting different results when using $geoNear (works) vs $near (doesn’t work). I need to use $near because I am working with Mongoose and it uses $near.

$geoNear works. I run this command:

db.runCommand({geoNear:"venues",near:[-122.418,37.775], maxDistance:10/69});

and I get results ordered by distance, within a 10 mile radius. Great.

But then I run this $near command and I get no results:

db.venues.find({loc: {$near: [-122.418,37.775] }, $maxDistance:10/69})

From what I can tell, they are the same command. Am I missing something? If I remove the $maxDistance, I do get results back and they are correctly ordered by distance. However, I also get results over 10 miles away.

db.venues.find({loc: {$near: [-122.418,37.77] }})
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:08:27+00:00Added an answer on June 15, 2026 at 8:08 pm

    You need to have $maxDistance : X inside the {$near} JSON document – you have it outside.

    Change db.venues.find({loc: {$near: [-122.418,37.775] }, $maxDistance:10/69})

    to be

    db.venues.find({loc: {$near: [-122.418,37.775], $maxDistance:10/69 } })

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doing so select name from sqlite_master where type='table' but I need to display all
Doing something like this: from zipfile import ZipFile #open zip file zipfile = ZipFile('Photo.zip')
Doing a Rails project with MongoDB + MongoMapper Rake creates the Mongo db with
Doing a simple db.Dictionary(select Id, Name from \Product\); results in an exception column id
Doing component-based development, I find myself doing this fairly often: public class SomeClass {
I frequently find myself doing some analysis in R and then wanting to make
I want to use scipy.spatial's KDTree to find nearest neighbor pairs in a two
I am trying to return spatial data (ie Point) from database using Hibernate Spatial
Doing the getting started of Sinatra. I get this error: ./sinatra.rb:5: undefined method `get'
Doing an ajax get request works as expected using the following code: $.ajax({ type:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.