[GODRIVER-763] Select field Created: 12/Jan/19 Updated: 04/Feb/19 Resolved: 04/Feb/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | bakatest | Assignee: | Kristofer Brandow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
How to select field. col.Find(nil).Select(bson.M{"name": 1}).One(&result) I see code at func "Decode" it's get all data in document from mongo before maping with struct in golang. Thank you. |
| Comments |
| Comment by bakatest [ 15/Jan/19 ] |
|
Thank you all. Yes, I need projection function. |
| Comment by Gustavo Silva Paiva [ 14/Jan/19 ] |
|
I guess he is looking for how to do projections, maybe this example can help: https://github.com/mongodb/mongo-go-driver/blob/master/examples/documentation_examples/examples.go#L1103 |
| Comment by Kristofer Brandow (Inactive) [ 14/Jan/19 ] |
|
Hi bakatest, Can you please provide a complete, runnable code example of what you are trying to accomplish? Thanks, Kris |