google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

Problem with near(x,y,r) method #340

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version are you using? (Morphia/Driver/MongoDB)
taken from pom.xml :
<dependency>
            <groupId>com.google.code.morphia</groupId>
            <artifactId>morphia</artifactId>
            <version>1.00-SNAPSHOT</version>
</dependency>

Please include a stack trace below:
Hi, 

I'm getting an exception using the near method:  near(x,y,r)   where x,y,r are 
doubles. 

Here is the exception: 

com.mongodb.MongoException: can't find special index: 2d for: { $and: [ { 
model: { $in: [ { $ref: "model", $id: ObjectId('4ead3cf1d68c293b7900053f') }, { 
$ref: "model", $id: ObjectId('4eae9edad68c2902bc0002a0') } ] } }, { 
locationList.loc: { $near: [ 31.88957, 35.201856 ], $maxDistance: 0.044248 } } 
] } com.mongodb.MongoException.parse(MongoException.java:82) 
com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:312) 
com.mongodb.DBCursor._check(DBCursor.java:369) 
com.mongodb.DBCursor._hasNext(DBCursor.java:498) 
com.mongodb.DBCursor.hasNext(DBCursor.java:523) 
com.google.code.morphia.query.MorphiaIterator.hasNext(MorphiaIterator.java:40) 

When taking the same query above to the shell of Mongo, It returns results with 
no exceptions. 

The mongo version I am using is: 
MongoDB  2.0.0.0

The Morphia version in my pom.xml is: 
<dependency>
            <groupId>com.google.code.morphia</groupId>
            <artifactId>morphia</artifactId>
            <version>1.00-SNAPSHOT</version>
</dependency>

Please advise how to solve this issue.

Thank you

Original issue reported on code.google.com by ajmannat...@gmail.com on 14 Nov 2011 at 8:07

GoogleCodeExporter commented 9 years ago
Please test with 0.99.1-SNAPSHOT. It is the most current.

Original comment by scotthernandez on 14 Nov 2011 at 12:49