I've a REST application with a 2.6.5 mongodb persistence.
My DAO use mongojack/JacksonDBCollection (ie JacksonDBCollection.insert, JacksonDBCollection.update)
When i insert/update a document containing a date I have the following (mongodb log) :
update: { _id: ObjectId(' 5494665384ae2a79c5817dcd'), title: "THE TITLE",.... , date: new Date(1419012062698),... }
The field date, when querying with mongo shell is ISODate("2014-12-19T18:01:02. 698Z").
Well. Now when I querying with application, I build the query with the mongo-driver QueryBuilder.
The resulting query is the following (mongodb log) :
which returns no results.
I think that the date format is not correct (following the forum discussions on the subject) so I should use ISODate as query :
which works.
So, my question is : what is the origin of problem ? The use of mongojack or the use of QueryBuilder ?
What is opinion?
Well. Now when I querying with application, I build the query with the mongo-driver QueryBuilder.
The resulting query is the following (mongodb log) :
{ $or: [ { title: "THE TITLE", date: { $gte: { $date: "2014-11-18T23:00:00.000Z" }, $lte: { $date: "2014-12-20T22:59:59.000Z" } } } ] }
which returns no results.
I think that the date format is not correct (following the forum discussions on the subject) so I should use ISODate as query :
{ $or: [ { title: "THE TITLE", date: { $gte: ISODate("2014-11-18T23:00:00. 000Z"), $lte: ISODate("2014-12-20T22:59:59. 000Z") } } ] } So, my question is : what is the origin of problem ? The use of mongojack or the use of QueryBuilder ?
What is opinion?
댓글 없음:
댓글 쓰기