-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Criteria.getCriteriaObject invalid when using Criteria.expr #4685
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
Comments
The |
Zooming out: What are you trying to achieve? |
I'm using ReactiveMongoTemplate to do custom queries without mapping to a Class, using I see there is also the I can understand if you consider that the Criteria class is not supposed to be used to generate a valid Bson document that can be directly be sent to mongo, and that it must be used together with the QueryMapper (meaning with mapping to a given MongoPersistentEntity). For my use case I have an easy workaround which consists in going through the generated Document and call again toDocument on non-bson values. However it would be nice that all implementations of |
The bigger issue is that Spring Data implementations need to express certain query operations and have to carry these around until they are transformed into a format that the underlying store understands. For better or worse,
|
Following #2750 which adds the method
Criteria.expr
, when using the methodCriteria.getCriteriaObject
it generates an invalid Document because MongoExpression is not a Document.I think that the method
Criteria.getSingleCriteriaObject
should callMongoExpression.toDocument()
when a value is an instance of MongoExpression.spring-data-mongodb version: 4.2.4
Small example:
output:
The text was updated successfully, but these errors were encountered: