Setting incorrect dates #1

nictuku opened this Issue Nov 21, 2010 · 0 comments

1 participant


After adding a document with date = time.UTC(), I get this:
"Thu Jan 15 1970 23:26:21 GMT+0100 (CET)"

But I should be getting this:
Mon Nov 22 2010 00:42:32 GMT+0100 (CET)

I don't think the problem happens during marshaling, because I can marshal and unmarshal the document and the date field looks normal.

One interesting information:

  • When I re-marshal the go-bson bson.Doc object using mikejs's library and then use his gomongo library to Insert the document, it works.

So we can compare the BSON message payload between the two and that may give an explanation (note: it's the same date, and same document):

(ignore the rest of the message, what matters is the date field, the last one):

mongogo = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00unfollow3.user_followers\x00Q\x00\x00\x00\x12uid\x00%\xa0\xf7\f\x00\x00\x00\x00\x04followers\x00&\x00\x00\x00\x120\x00\xa9\x9b\xee\x00\x00\x00\x00\x00\x121\x00:\xf5\xae\x00\x00\x00\x00\x00\x122\x00\xa1\x1d\x03\x01\x00\x00\x00\x00\x00\tdate\x00h\xaf\xe9L\x00\x00\x00\x00\x00"

gomongo (works) = "~\x00\x00\x00\x94m\xb3\x04\x00\x00\x00\x00\xd2\a\x00\x00\x00\x00\x00\x00unfollow3.user_followers\x00Q\x00\x00\x00\x12uid\x00%\xa0\xf7\f\x00\x00\x00\x00\x04followers\x00&\x00\x00\x00\x120\x00\xa9\x9b\xee\x00\x00\x00\x00\x00\x121\x00:\xf5\xae\x00\x00\x00\x00\x00\x122\x00\xa1\x1d\x03\x01\x00\x00\x00\x00\x00\tdate\x00@.\xd5p,\x01\x00\x00\x00"

I spent a long time debugging this but couldn't find the cause yet. This is the best I could do so far to isolate the problem.

  • Yves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment