package tools import ( "context" "go.mongodb.org/mongo-driver/mongo" ) // Mongo3CtxKey is the context key for the go-mongo-driver mongo.Client const Mongo3CtxKey Contextkey = 50 // Contextkey type is used to store/retrieve mongo3 client from ctx type Contextkey int // MongoFromContext will pull the mongo.Client out of the context func MongoFromContext(ctx context.Context) *mongo.Client { return ctx.Value(Mongo3CtxKey).(*mongo.Client) }