summaryrefslogtreecommitdiff
path: root/common/bsonutil/converter.go
diff options
context:
space:
mode:
Diffstat (limited to 'common/bsonutil/converter.go')
-rw-r--r--common/bsonutil/converter.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/bsonutil/converter.go b/common/bsonutil/converter.go
index 17c44cb5fc2..3be732de332 100644
--- a/common/bsonutil/converter.go
+++ b/common/bsonutil/converter.go
@@ -96,7 +96,7 @@ func ConvertJSONValueToBSON(x interface{}) (interface{}, error) {
}
}
-func convertKeys(v bson.M) (map[string]interface{}, error) {
+func convertKeys(v bson.M) (bson.M, error) {
for key, value := range v {
jsonValue, err := ConvertBSONValueToJSON(value)
if err != nil {
@@ -157,7 +157,7 @@ func ConvertBSONValueToJSON(x interface{}) (interface{}, error) {
return json.ObjectId(v.Hex()), nil
case time.Time: // Date
- return json.Date(v.UnixNano() / 1e6), nil
+ return json.Date(v.Unix()*1000 + int64(v.Nanosecond()/1e6)), nil
case int64: // NumberLong
return json.NumberLong(v), nil