Use props in Find

This commit is contained in:
George Suntres
2026-04-18 20:19:32 -04:00
parent 4ddb396b76
commit 28195b7ce5
4 changed files with 18 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ func BuildFind(col map[string]any, report *InitReport) {
in := []reflect.Type{
reflect.TypeOf((*context.Context)(nil)).Elem(),
reflect.TypeOf((*map[string]any)(nil)).Elem(),
reflect.TypeOf((*int64)(nil)).Elem(),
reflect.TypeOf((*mongo.FindOptions)(nil)).Elem(),
}
out := []reflect.Type{
reflect.TypeOf(bson.M{}),
@@ -45,7 +45,7 @@ func BuildFind(col map[string]any, report *InitReport) {
mc := mongo.GetMongoClient()
// we defer function's implementation until we create the actual struct
deferedFuncs[funcName] = func(ctx context.Context, filter map[string]any, limit int64) (bson.M, error) {
deferedFuncs[funcName] = func(ctx context.Context, filter map[string]any, opts *mongo.FindOptions) (bson.M, error) {
db := "__undefined__"
if isSystem {
db = sysDb
@@ -56,6 +56,5 @@ func BuildFind(col map[string]any, report *InitReport) {
}
}
return mc.Find(ctx, db, name, filter, limit)
}
}
return mc.Find(ctx, db, name, filter, opts)
}}