user3807534
user3807534

Reputation: 1

mongodb + java + iso date search

In my mongo db database i have column like this.

"created_on" : ISODate("2014-07-02T01:38:48.713Z");

In order to to search this column am giving the following query:

db.XYZ.find({ "created_on" : ISODate("2014-07-02T01:38:48.713Z")})

Now i want to use java for retrieving this data from database: My query is like:

 DateTime dateTime = new DateTime( "2014-07-02T01:38:48.713Z" );
 BasicDBObject query1 = new BasicDBObject("created_on", dateTime);
 DBCursor cursor = table.find(query);

but am not getting anything query is returning 0 rows??

Any body please help how to set iso date from java.

Upvotes: 0

Views: 703

Answers (1)

Zarathustra
Zarathustra

Reputation: 2953

The mongodb driver does not work with DateTime currently. You have to use java.util.Date

Upvotes: 1

Related Questions