Closed pkaeding closed 5 years ago
Hi @pkaeding,
Sorry for the delay!
I've tried reproducing the issue with the information provided, but the test in your gist is working for me (I'm using mgo version 3.2.21 instead of 3.2.17).
Did you manage to solve the problem?
Did you maybe try with a newer version of mgo? I'm not sure if that would help in this case, but the bson encoding/decoding hasn't been changed for a while so it doesn't seem like a library issue.
Thanks, Esther
I'll close this issue, please feel free to reopen if there's a problem with the driver. Thanks, Esther
What version of MongoDB are you using (
mongod --version
)?What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
This gist illustrates the issue: https://gist.github.com/pkaeding/b361060b3b56112dfe01b84942afe648
It seems that when a struct has a
*time.Duration
field, that value is serialized as a number of milliseconds, but deserialized as nanoseconds. If the field is atime.Duration
(ie, not a pointer), then the round trip serialization/deserialization works fine.Can you reproduce the issue on the latest
development
branch?Yes, I get the same results with
ae196ac5024de13358780893f917b65ec1d2a7be
(development) andeeefdecb41b842af6dc652aaea4026e8403e62df
(master)Related: https://github.com/globalsign/mgo/issues/212