Gt
Overview
Gt matches field > value.
Part of the mongo package — Node.js analog: mongoose.
Signature
go
func Gt(field string, value any) bson.MCompare: Node.js · Standard Go · gox
js
// Typical mongoose pattern in Node.jsgo
client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))go
import "github.com/sahilkhaire/gox/mongo"
filter := mongo.Gt("age", 18)Example
go
import "github.com/sahilkhaire/gox/mongo"
filter := mongo.Gt("age", 18)Tips
Pass context.Context as the first argument so cancellation and deadlines propagate correctly.
Standard library alternative
Use the standard library directly:
go
client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))