strange date query results

15 views
Skip to first unread message

Jan Sørensen

unread,
Sep 10, 2010, 5:39:17 AM9/10/10
to mongod...@googlegroups.com
Hi everybody,

I'm pretty new to mongo and I hope someone can help me.

While querying a small collection of articles (~100 000) I have noticed that there is something wrong with date ranges including 01.01.1970 - no results are shown, while data is present.
Queries like 1895-01-01 ÷ 1960-12-31, 1895-01-01 ÷ 1969-12-31 and 1970-12-31 ÷ 2136-12-31 are just fine.
When the range includes 01.01.1970 like: 1895-01-01 ÷ 1980-12-31, 1895-01-01, 1970-12-31, 1933-01-01 ÷ 1998-12-31 no results are found.
The date index is ok, mongo.log doesn't show anything strange...
Mongo is 1.4.4.

Regards,
js
---

dwight_10gen

unread,
Sep 10, 2010, 6:39:06 AM9/10/10
to mongodb-user
mongo does not yet support dates before 1/1/1970 (the "epoch") -
unfortunately the date type is unsigned.

this is nontrivial to fix as it effects index comparison order, thus
we are waiting for a release where a data migration is required, and
we always are trying to avoid that.

Jan Sørensen

unread,
Sep 10, 2010, 7:05:16 AM9/10/10
to mongod...@googlegroups.com
ok, thanks for the info. When to expect that release ?

Regards,
js
---

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

Kristina Chodorow

unread,
Sep 10, 2010, 8:58:24 AM9/10/10
to mongod...@googlegroups.com
You can watch/track http://jira.mongodb.org/browse/SERVER-405.  It is scheduled for 1.7.x.

Jan Sørensen

unread,
Sep 10, 2010, 9:05:20 AM9/10/10
to mongod...@googlegroups.com
Thanks a lot ! 

It's a quite important issue and I need some kind of workaround - one would be to combine two (or more) result sets - is it possible to make some kind of 'UNION ALL' in mongo ?

Regards, 
js
--- 

Kristina Chodorow

unread,
Sep 10, 2010, 9:11:24 AM9/10/10
to mongod...@googlegroups.com

Jan Sørensen

unread,
Sep 10, 2010, 10:41:17 AM9/10/10
to mongod...@googlegroups.com
cool ! 
10x again :)
--
js

Matthias Götzke

unread,
Sep 12, 2010, 11:39:46 AM9/12/10
to mongodb-user
We fixed it by just storing a date as a signed long and doing the date
conversion client side.

BTW: I dont quite understand why fixing this takes so long. You could
have one field in the database or as a startup parameter which
defaults to old-style on existing databases which defines the
behavior. That way new customers would not see the issue, old
customers (which could be warned upon startup) could migrate whenever
they have the time.

On Sep 10, 4:41 pm, Jan Sørensen <jansorensen...@gmail.com> wrote:
> cool !
> 10x again :)
> --
> js
>
> On Sep 10, 2010, at 4:11 PM, Kristina Chodorow wrote:
>
>
>
>
>
>
>
> > You could probably use $or:http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-...
>
> > On Fri, Sep 10, 2010 at 9:05 AM, Jan Sørensen <jansorensen...@gmail.com> wrote:
> > Thanks a lot !
>
> > It's a quite important issue and I need some kind of workaround - one would be to combine two (or more) result sets - is it possible to make some kind of 'UNION ALL' in mongo ?
>
> > Regards,
> > js
> > ---
>
> > On Sep 10, 2010, at 3:58 PM, Kristina Chodorow wrote:
>
> >> You can watch/trackhttp://jira.mongodb.org/browse/SERVER-405.  It is scheduled for 1.7.x.
> >> > For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> >> To post to this group, send email to mongod...@googlegroups.com.
> >> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> >> To post to this group, send email to mongod...@googlegroups.com.
> >> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com.
> > To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
Reply all
Reply to author
Forward
0 new messages