Use props in Find
This commit is contained in:
@@ -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)
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user