Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Query annotation does not support $centerSphere [DATAMONGO-2633] #3488

Closed
spring-projects-issues opened this issue Sep 25, 2020 · 2 comments
Closed
Assignees

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Sep 25, 2020

hkka opened DATAMONGO-2633 and commented

I want to create a geospatial query in a ReactiveMongoRepository, and use following functions :

  • $geoWithin
  • $centerSphere
@Query("{'stores.location' : { $geoWithin: { $centerSphere: [ [ 1.948516, 48.799029 ] , 0.004 ] } } }")

But unfortunately i'am getting a runtime error : 

ReadEndArray can only be called when State is END_OF_ARRAY, not when State is VALUE.ReadEndArray can only be called when State is END_OF_ARRAY, not when State is VALUE.org.bson.BsonInvalidOperationException: ReadEndArray can only be called when State is END_OF_ARRAY, not when State is VALUE. at org.bson.AbstractBsonReader.throwInvalidState(AbstractBsonReader.java:669) at org.bson.AbstractBsonReader.readEndArray(AbstractBsonReader.java:334) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readList(ParameterBindingDocumentCodec.java:349) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:317) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:200) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:62) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:331) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:200) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:62) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.readValue(ParameterBindingDocumentCodec.java:331) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:200) at org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec.decode(ParameterBindingDocumentCodec.java:176) at org.springframework.data.mongodb.repository.query.ReactiveStringBasedMongoQuery.createQuery(ReactiveStringBasedMongoQuery.java:122) at org.springframework.data.mongodb.repository.query.AbstractReactiveMongoQuery.doExecute(AbstractReactiveMongoQuery.java:147) at org.springframework.data.mongodb.repository.query.AbstractReactiveMongoQuery.execute(AbstractReactiveMongoQuery.java:132) at org.springframework.data.mongodb.repository.query.AbstractReactiveMongoQuery.execute(AbstractReactiveMongoQuery.java:104) at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor$QueryMethodInvoker.invoke(QueryExecutorMethodInterceptor.java:195) at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:152) at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:130) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy103.byCenterSphere(Unknown Source) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy103.byCenterSphere(Unknown Source)

I can add the same is working with ReactiveMongoTemplate :

BasicQuery query = new BasicQuery("{'stores.location' : { $geoWithin: { $centerSphere: [ [ 1.948516, 48.799029 ] , 0.004 ] } } }");
final Flux<Provider> actual = reactiveMongoTemplate.find(query, Pojo.class);

Thank you


Affects: 3.0.4 (Neumann SR4)

Referenced from: pull request #888

Backported to: 3.0.5 (Neumann SR5), 2.2.11 (Moore SR11)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 28, 2020

Christoph Strobl commented

Good catch - thanks for reporting!

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 28, 2020

hkka commented

welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.