I have a few models that store durations in time.Duration. When marshalling these they get divided by 1000 which i understand is expected behaviour. However when i then load the same document back from Mongo the time.Duration does not get multiplied back to Go format. This is a very weird behaviour, I've had to write custom Unmarshal functions that multiply values by 1000.
Can you reproduce the issue on the latest development branch?
I found my issue. The bson tag was incorrect on my struct and coincidently the logger also truncated the number so it was a false positive. You may close this.
We use the issue tracker to track bugs with mgo - if you have a usage question, it's best to try Stack Overflow :)
Replace this text with your description, and please answer the questions below before submitting your issue to help us out. Thanks!
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?
I have a few models that store durations in time.Duration. When marshalling these they get divided by 1000 which i understand is expected behaviour. However when i then load the same document back from Mongo the time.Duration does not get multiplied back to Go format. This is a very weird behaviour, I've had to write custom Unmarshal functions that multiply values by 1000.
Can you reproduce the issue on the latest
development
branch?Not sure yet.