Hello Team
I executed following in mongodb successfully
db.runCommand( { count : ‘name’, query: { createDate: { $gte: new Date(new Date().getTime() - 2 * 1000 * 60 * 60 ) } } });
now I’m trying to execute the same in Spring mongoTemplate.executeCommand and get failed with following exception.
org.bson.json.JsonParseException: JSON reader expected an integer or a string but found ‘new’.
I noticed the problem is with Document.parse (inside montoTemplate.executeMethod) is failing to parse below
new Date(new Date().getTime() - 2 * 1000 * 60 * 60 )
How to get successful for the above section in Document.parse.