-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: API
-
Labels:None
-
Environment:OS X Mountain Lion
the index is set with :
db.offerings.ensureIndex(
)
while the shell query returns 1 document :
db.offerings.find( { coord :
{ $near : [-122,37] }, categoryId : '212' } );
the java version returns two including one with categoryId not equal 212 (212 shows in the debugger as the value of cat)
String lat = (String) this.getRequest().getAttributes().get("lat");
String lon = (String) this.getRequest().getAttributes().get("long");
String cat = (String) this.getRequest().getAttributes().get("cat");
DBCollection coll = database.getCollection("offerings");
Double locationLongitude = null;
Double locationLatitude = null;
try
{ locationLongitude = Double.valueOf(lon.trim()).doubleValue(); locationLatitude = Double.valueOf(lat.trim()).doubleValue(); }catch (NumberFormatException e)
{ System.out.println("NumberFormatException: " + e.getMessage()); }DBCursor cur = coll.find(new BasicDBObject("coord",JSON.parse("{$near : [ " + locationLongitude + "," + locationLatitude + " ]}, categoryId : " + cat)));
try {
JSONObject offeringAsJson = new JSONObject();
while(cur.hasNext()) {
DBObject obj = cur.next();
System.out.println("\nGetNext value for categoryId:"+ obj.get("categoryId"));
- related to
-
JAVA-672 JSON.parse should throw an exception if the input string is not fully consumed
- Closed