[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: PNG File Screen Shot 2562-01-13 at 02.00.34.png    

 Description   

How to select field.
Exam.

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.
Sry i don't know how to tag name TT^TT.

Yes, I need projection function.
Can't wait to see full tutorial and document in GolangĀ 
A lot Go dev just gen doc. but I think it's bad thing to started or tutorial
https://docs.mongodb.com/v3.2/tutorial/project-fields-from-query-results/

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

Generated at Thu Feb 08 08:34:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.