0

I want to know how to convert these mongo cell query into spring mongo query

{$addFields:{"creationTime":{$toLong:"$creationTime"}}}

or

{ "$group" : { "_id" : "$id","timestamp" : { "$push" : {$toLong:"$creationTime" }} } }
jss
  • 199
  • 2
  • 13
  • i found one way using below convrtor and then use projection var c=ConvertOperators.ConvertOperatorFactory("creationTime").convertToLong() var projectionOperation= Aggregation.project().and(c).`as`("creationTime") – jss Nov 16 '18 at 11:26
  • `spring-mongodb` does not not support such expressions "directly" within a `$group`. You either do a separate `project()` first as you discovered, or construct a custom aggregation stage directly without "helpers". One such [example of the latter](https://stackoverflow.com/a/50409636/2313887) – Neil Lunn Nov 18 '18 at 23:08

0 Answers0