Lucas
Lucas

Reputation: 481

How do I query MongoDB's ISODate field using Java querybuilder

I would like to do a query based on a MongoDB ISODate field. However, I'm not sure how to serialize a Java Date object into the correct ISODate object, which can then be used with QueryBuilder. A little example code would be greatly appreciated. Thanks a lot.

Upvotes: 0

Views: 1646

Answers (1)

Remon van Vliet
Remon van Vliet

Reputation: 18615

Serialization of a Date object to the appropriate representation in JSON ({$date:

builder.greaterThan(new Date())

works just fine. Be wary of timezones though.

Upvotes: 1

Related Questions