Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Mongo db spatial query support with java
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ronnie  
View profile  
 More options May 2 2012, 1:55 am
From: Ronnie <ankur...@tcs.com>
Date: Tue, 1 May 2012 22:55:49 -0700 (PDT)
Local: Wed, May 2 2012 1:55 am
Subject: Re: Mongo db spatial query support with java
I am using MongoDB  Version 2.04 , from the shell the following query
is executed.

But when trying from Java , it fails and throws exception.

Exception in thread "main" com.mongodb.MongoException: can't find
special index: 2d for: { foi_geom: { $within: { $box: [ [ 9, 51 ],
[ 12, 54 ] ] } } }

On May 2, 10:41 am, "H.J" <shiyi...@gmail.com> wrote:

> Would you please provide some documents sample? And your java driver
> version and mongodb version?

> It works here.
> java dirver 2.7.3, mongodb 2.1.1-pre

> http://pastebin.com/diKny2HF

> 2012/5/2Ronnie<ankur...@tcs.com>:

> > Thanks , but I am getting this exception :

> > Exception in thread "main" com.mongodb.MongoException: can't find
> > special index: 2d for: { foi_geom: { $within: { $box: [ [ 9, 51 ],
> > [ 12, 54 ] ] } } }
> >        at com.mongodb.MongoException.parse(MongoException.java:82)
> >        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:303)
> >        at com.mongodb.DBCursor._check(DBCursor.java:356)
> >        at com.mongodb.DBCursor._hasNext(DBCursor.java:486)
> >        at com.mongodb.DBCursor.hasNext(DBCursor.java:511)
> >        at
> > com.tcs.mongo.util.MongoSpacialQuery.getFeatureOfInterestsInaBBox(MongoSpac ialQuery.java:
> > 103)
> >        at com.tcs.mongo.util.MongoSpacialQuery.main(MongoSpacialQuery.java:
> > 35)
> > I have indexed through shell like as follows:
> >  db.BLOOD_PRESSURE.ensureIndex({foi_geom : "2d"})

> > If the above is not working then how should I do the indexing?

> > Thanks in advance.

> > On May 1, 7:56 pm, "H.J" <shiyi...@gmail.com> wrote:
> >> Thank you Marc!

> >>Ronnie, may you try this one?

> >> DBCursor cur = coll.find(new
> >> QueryBuilder().start("foi_geom").withinBox(8.1,9.5,55.1,54.5).get());

> >> Sorry for late response, these days are holidays for Labor Day in China.

> >> 2012/4/30 Marc <m...@10gen.com>:

> >> > A similar question was asked last week regarding how to build a
> >> > $within query with the Java driver:
> >> >http://groups.google.com/group/mongodb-user/browse_thread/thread/a76b...

> >> > There is an example there of how to build the query document in the
> >> > Java driver.  The object 'myPolygon' in the example is of datatype
> >> > ArrayList<ArrayList<Integer>>

> >> > Hopefully the example will allow you to build your desired $within
> >> > query.  I am not familiar with the "QueryBuilder" object that you have
> >> > used in your example.  If you can come up with a less verbose way to
> >> > perform a $within query than building an ArrayList of ArrayLists of
> >> > integers point by point, please share it here, so the Community may
> >> > have the benefit of your experience.
> >> > Thanks.

> >> > --
> >> > You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> >> > To post to this group, send email to mongodb-user@googlegroups.com.
> >> > To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
> >> > For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.

> >> --
> >> 尽人事,听天命!

> > --
> > You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> > To post to this group, send email to mongodb-user@googlegroups.com.
> > To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.

> --
> 尽人事,听天命!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.