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 3535// if err != nil { log.Fatal(err) }
3636// defer cur.Close(context.Background())
3737// 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...
4150// }
4251// if err := cur.Err(); err != nil {
43- // return err
52+ // return err
4453// }
4554//
4655// 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