Details
-
New Feature
-
Resolution: Won't Fix
-
Major - P3
-
None
-
0.0.13
-
None
Description
DocumentResult shows correctly when passing to a bson.NewDocument.
bson.Document\{bson.Element{[objectID]"_id": ObjectID("5b989bbe733326cf1622e06a")}, bson.Element\{[UTC datetime]"datetime": 1536727804734}}
|
But get zero-value after marshaling struct.
type syncDateTime struct {
|
ID objectid.ObjectID `json:"id" bson:"_id, omitempty"`
|
LastUpdateTime int64 `json:"datetime" bson:"datetime"`
|
}
|
|
|
filter := bson.NewDocument(bson.EC.String("type_key", "lastUpdateTime"))
|
projection := findopt.Projection(bson.NewDocument(bson.EC.Int32("datetime", 1)))
|
sort := findopt.Sort(bson.NewDocument(bson.EC.Int32("datetime", -1)))
|
result := syncDateTime{}
|
err := cConfig.FindOne(context.Background(), filter, projection, sort).Decode(&result)
|
|
|
{ObjectID("5b989bbe733326cf1622e06a") 0}
|
Attachments
Issue Links
- depends on
-
GODRIVER-577 Add struct tags to choose BSON types
-
- Backlog
-