How to filter fields from a mongo document with the official mongo-go-driver

Edit: As the mongo-go driver evolved, it is possible to specify a projection using a simple bson.M like this: options.FindOne().SetProjection(bson.M{“_id”: 0}) Original (old) answer follows. The reason why it doesn’t work for you is because the field fields._id is unexported, and as such, no other package can access it (only the declaring package). You must … Read more