I've created an aggregation query which includes the following:
.and(String.format("{ $match: { codingDates: { $gte: ISODate('%s') } } }", startDate)) // startDate is a Joda LocalDate
When I try to execute the query, I'm seeing the following:
java.lang.IllegalArgumentException: Cannot parse query: { $match: { codingDates: { $gte: ISODate('2010-08-06') } } }
at org.jongo.query.BsonQueryFactory.createQuery(BsonQueryFactory.java:162)
at org.jongo.Aggregate.and(Aggregate.java:50)
The query works in the MongoDB shell and I'm puzzled to why I'm seeing the exception. Any ideas?
Thanks,
Rob
P.S. I tried using the templating approach prior to using String.format but nothing is returned. I suspect that the query is issued with the hash value left unmodified in that case.