i have basic code such as:
query := {"number": bson.M{"$gte": 100, "$lte":1000}}
value := bson.M{query}
cur, _:= collection.Find(ctx, value)
fmt.Println{v}
i want to push or insert bson.M{} with value of variable query.
if i push with string in front like: bson.M{"selector": query} code is working,
but i need push all value in variable query without string in the front.
can anyone help me? thank you
CodePudding user response:
Is this what you're looking to do?
query := map[string]interface{}{
"number": bson.M{"$gte": 100, "$lte":1000},
}
cur, _:= collection.Find(ctx, query)
