// http://docs.mongodb.org/manual/reference/operator/near/#op._S_near @Override public Filter createFilter(final List<String> path, DBObject refExpression) { LOG.debug("path:{}, refExp:{}", path, refExpression); Number maxDistance = typecast(MAX_DISTANCE, refExpression.get(MAX_DISTANCE), Number.class); final List<LatLong> coordinates; if (refExpression.get(command) instanceof BasicDBList) { coordinates = GeoUtil.latLon( Collections.singletonList(command), refExpression); // typecast(command, refExpression.get(command), List.class); } else { DBObject dbObject = typecast(command, refExpression.get(command), DBObject.class); coordinates = GeoUtil.latLon(Arrays.asList("$geometry", "coordinates"), dbObject); } return createNearFilter(path, coordinates, maxDistance, spherical); }