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 6379283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:07:04+00:00 2026-05-25T02:07:04+00:00

I was reading the documentation for MongoDB here and I found it really interesting.

  • 0

I was reading the documentation for MongoDB here and I found it really interesting. However, there was one feature that seemed to be very-much in reach but was not explicitly documented. That is the concept of geo-fencing. If I create a radius (or a rectangle), how can I perform a query such that I can provide a point and Mongo can tell me if that point is inside of the defined area(s) instead of having to query for nearby areas and perform a Ray-Casting algorithm (or some other algorithm) to determine if my provided point lies within those areas.

Any help in the right direction or, even better, some examples of how to do this with MongoDB is greatly appreciated. Thanks!

Update
Just to let everyone know what I did. I ended up rolling my own solution built on top of Mongo (to utilize it’s existing geo-spatial index/query abilities) and it works rather well for a prototype. As a solution to use in production, it could definitely use some improvements. But, I wrote a blog series on how I approached the problem along with a sample server in Ruby. You can find part one of the blog on my site here.

  • 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-05-25T02:07:05+00:00Added an answer on May 25, 2026 at 2:07 am

    Unfortunately mongodb’s geo indexes are for storing point-data only. To store regions would require some serious reworking of the data structure we are using and is a long-term goal, but will not happen in the short term. As a work around, if your regions are roughly similarly sized you might be able to get away with storing the center point of each region. Then you could fetch the ten closest regions and do a client-side filter in your app to figure out which region the query point is in.

    Alternatively, you could make an idealized grid and store the grid squares that each region contains in an array for that region. Then map the query point to it’s grid square, and figure out which region (if more than one for that square) the point is in. This is actually similar to how we implement our geo index although we use a dynamic grid. You should use a normal (non-geo) index if you want to go this route.

    While neither of these are ideal, hopefully they will provide a workable solution.

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

Sidebar

Related Questions

Reading Kohana's documentation, I found out that the main difference in 3.0 version is
I know there is array_key_exists() but after reading the documentation I'm not really sure
By reading the documentation here it seems to me that re.compile(r'^[-\w]+$') would just search
Reading Apple documentation i found that UIEventTypeMotion is useful only to intercept Shake. It
While reading documentation on some library, I saw that some library have some feature,
Reading through documentation, I found following: 1.9.1 1.8.4 1.8.2 A version of 1.8.2 select
Reading the documentation it seems this might not be possible, but it seems that
When reading some documentation about assertions, I found: java -ea -dsa Enables assertions in
I know from reading Microsoft documentation that the "primary" use of the IDisposable interface
I am reading documentation that says setValue:forKey: will treat a NULL value as if

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.