Announcement Announcement Module
Collapse
No announcement yet.
MongoRepository JSON Query parse exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MongoRepository JSON Query parse exception

    public interface DomainRepository extends MongoRepository<Domain, String> {
    @Query(value = "{\"geo\" : {\"$within\" : {\"$center\" : [[ ?0, ?1 ], ?2]}}}")
    List<Domain> findBySpatial(double longitude, double latitude, double radius);
    }

    is throwing the following exception, Whats wrong with the query ?

    com.mongodb.util.JSONParseException:
    {"geo" : {"$within" : {"$center" : [[ ?0, ?1 ], 1.0E-6]}}}
    ^
    at com.mongodb.util.JSONParser.parse(JSON.java:317)
    at com.mongodb.util.JSONParser.parseArray(JSON.java:6 43)

    at com.mongodb.util.JSONParser.parse(JSON.java:310)
    at com.mongodb.util.JSONParser.parseArray(JSON.java:6 43)
    at com.mongodb.util.JSONParser.parse(JSON.java:310)
    at com.mongodb.util.JSONParser.parseObject(JSON.java: 350)
    at com.mongodb.util.JSONParser.parse(JSON.java:314)
    at com.mongodb.util.JSONParser.parseObject(JSON.java: 350)
    at com.mongodb.util.JSONParser.parse(JSON.java:314)
    at com.mongodb.util.JSONParser.parseObject(JSON.java: 350)
    at com.mongodb.util.JSONParser.parse(JSON.java:314)
    at com.mongodb.util.JSONParser.parse(JSON.java:269)
    at com.mongodb.util.JSON.parse(JSON.java:228)
    at com.mongodb.util.JSON.parse(JSON.java:213)
    at org.springframework.data.document.mongodb.query.Ba sicQuery.<init>(BasicQuery.java:35)
    at org.springframework.data.document.mongodb.reposito ry.StringBasedMongoQuery.createQuery(StringBasedMo ngoQuery.java:71)
    at org.springframework.data.document.mongodb.reposito ry.AbstractMongoQuery.execute(AbstractMongoQuery.j ava:76)
    at org.springframework.data.repository.support.Reposi toryFactorySupport$QueryExecuterMethodInterceptor. invoke(RepositoryFactorySupport.java:330)

  • #2
    Looks like @Query with multiple parameters is not being handled properly
    Last edited by maple; May 15th, 2011, 11:30 AM.

    Comment


    • #3
      logged a JIRA issue

      https://jira.springsource.org/browse/DATADOC-137

      Comment

      Working...
      X