Вопрос

When querying for a date with Spring Data on MongoDB, the serialized DBObject could look something like {"start" : { "$lt" : {"$date" : "2012-08-06T16:19:14.044Z"}}}, which is valid in the context of Spring Data, but that query brings no results in Mongo's console. In the console this one does return the expected results {"start" : { "$lt" : ISODate("2012-08-06T16:19:14.044Z")}}}.

So what is making queries in Spring Data and Mongo's console different? Thx

Это было полезно?

Решение

You can't run the "serialized" query from Spring Data in the shell. The "serialized" query shows up in standard JSON, rather than the extended JSON that contains ISODate(), etc., and it's not compatible with the shell.

http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top