Hi, I’m new with the mongodb driver for mongo but I’m quite experienced with other languages drivers.
I’m using the struct tags to insert document and I was wondering if there’s a way to use them (or any other way) to write strongly typed queries, projections, sorting documents.
I tried to look around but it seems everyone uses just strings over and over, and I hoped there would be a better way. I investigated a bit the bson package with the idea of marshalling the document myself but I cannot cover all cases.
Thank you for your answer Jack, but I’m not sure this would solve my problem. I’m looking for a method to write strongly typed code, possibly reusing the struct I already wrote, instead of using strings.
Thank you and sorry if the question was not clear.
In answer to your question, it seems to me that Golang considers the “Builder” pattern exhibited by the C#/.NET driver to be a liability more than an asset. Vide the Go Proverbs: