File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 35
35
// if err != nil { log.Fatal(err) }
36
36
// defer cur.Close(context.Background())
37
37
// for cur.Next(context.Background()) {
38
- // raw, err := cur.DecodeBytes()
39
- // if err != nil { log.Fatal(err) }
40
- // // do something with elem....
38
+ // // To decode into a struct, use cursor.Decode()
39
+ // result := struct{
40
+ // Foo string
41
+ // Bar int32
42
+ // }{}
43
+ // err := cur.Decode(&result)
44
+ // if err != nil { log.Fatal(err) }
45
+ // // do something with result...
46
+ //
47
+ // // To get the raw bson bytes use cursor.Current
48
+ // raw := cur.Current
49
+ // // do something with raw...
41
50
// }
42
51
// if err := cur.Err(); err != nil {
43
- // return err
52
+ // return err
44
53
// }
45
54
//
46
55
// Methods that only return a single document will return a *SingleResult, which works
You can’t perform that action at this time.
0 commit comments