spring-data-mongodb
spring-data-mongodb copied to clipboard
Is it possible to allow ArithmeticOperators and ProjectionOperation to have date as argument for subtract and add operation ? [DATAMONGO-1675]
Shiv Veeram opened DATAMONGO-1675 and commented
valueOf method for add & subtract in ArithmeticOperators along with minus & plus methods on ProjectionOperation currently expects Number value, AggregationExpression or a fieldReference.
This is the shell equivalent { $subtract: [ new Date(), "$created" ] }
valueOf("created").subtract(new Date()) is not possible in ArithmeticOperators
We've to use something like valueOf(aggregationOperationContext -> new BasicDBObject("$subtract", Arrays.asList(new Date(), "$created"))) to pass two date values.
Let me know if you need more information.
Arithmetic Operators http://stackoverflow.com/questions/42840426/mongo-aggregation-using-new-date-as-in-input-to-form-a-aggregationexpression
Projection Operation http://stackoverflow.com/questions/43647540/spring-data-mongo-db-query-translation
Affects: 1.10 RC1 (Ingalls)
Shiv Veeram opened DATAMONGO-1675 and commented
valueOf method for add & subtract in ArithmeticOperators along with minus & plus methods on ProjectionOperation currently expects Number value, AggregationExpression or a fieldReference.
This is the shell equivalent { $subtract: [ new Date(), "$created" ] }
valueOf("created").subtract(new Date()) is not possible in ArithmeticOperatorsWe've to use something like valueOf(aggregationOperationContext -> new BasicDBObject("$subtract", Arrays.asList(new Date(), "$created"))) to pass two date values.
Let me know if you need more information.
Arithmetic Operators http://stackoverflow.com/questions/42840426/mongo-aggregation-using-new-date-as-in-input-to-form-a-aggregationexpression
Projection Operation http://stackoverflow.com/questions/43647540/spring-data-mongo-db-query-translation
Affects: 1.10 RC1 (Ingalls)
非常感谢!