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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:24:08+00:00 2026-06-09T05:24:08+00:00

Is it possible to perform a geospatial search in MongoDB in the resulting area

  • 0

Is it possible to perform a geospatial search in MongoDB in the resulting area from the difference of two circles. Let’s say that I have a circle A of radius x and another circle B of radius y where y > x. I need to find all the points that are inside B – A. Is this possible with MongoDB. I know that MongoDB support polygon searches but maybe there is a better way. Keep in mind that I’m using Mongo from a rails application using mongoid.

  • 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-09T05:24:10+00:00Added an answer on June 9, 2026 at 5:24 am

    Yes,it is possible.
    use $within operator.

    http://www.mongodb.org/display/DOCS/Geospatial+Indexing/#GeospatialIndexing-Querying

    Bounds Queries

    $within can be used instead of $near to find items within a shape. Results are not sorted by distance, which may result in faster queries when this sorting is not required. Shapes of type $box (rectangles), $center (circles), and $polygon (concave and convex polygons) are supported. All bounds queries implicitly include the border of the shape as part of the boundary, though due to floating-point inaccuracy this can’t strictly be relied upon.

    To query for all points within a rectangle, you must specify the lower-left and upper-right corners:
    A circle is specified by a center point and radius:

    center = [50, 50]
    radius = 10
    db.places.find({“loc” : {“$within” : {“$center” : [center, radius]}}})

    One approach would be that you can find points within both circles, then do an intersection of the sets.
    This would work for both cases, if the circles are concentric, or if not concentric but having some overlapping area.

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

Sidebar

Related Questions

Is it possible to perform a global reversed-find on NHibernate-managed objects? Specifically, I have
Is it possible to perform date arithmetic using JPA/Hibernate? For example, I have an
Is it not possible to perform two deletes in one query by separating them
Say I have a table of data that looks like: ItemNo | ItemCount |
Is it possible to perform a request that checks the string representation of a
Is it possible to perform MySQL replication from the master database on Linux to
In C#, is it possible to perform a sum of two 32-bit integers without
In MySQL , I have two different databases -- let's call them A and
Is it possible to perform a MySQL search and replace while honoring wildcards? eg:
With FORTRAN 77 is it possible to perform a swap on two arrays, in

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.