I am trying to convert a working mongo query to bson in golang. I have the basic stuff down and working but am struggling to figure out how to integrate more advanced or
queries into the mix.
Anyone have a minute to help me convert the following query? It should hopefully give me the direction I need... Unfortunately I have not been able to find many examples outside of just evaluating and queries.
This works in mongo:
db.my_collection.find({"$or": [
{"dependencies.provider_id": "abc"},
{"actions.provider_id": "abc"}]})
This works in golang/bson:
bson.M{"dependencies.provider_id": "abc"}
How do I go about properly introducing the or
statement?
In your case, it would be:
bson.M{"$or": []bson.M{
{"dependencies.provider_id": "abc"},
{"actions.provider_id": "abc"},
}}