Fix broken filtering through discriminator

This commit is contained in:
George Suntres
2026-04-17 20:46:00 -04:00
parent 99b36e577e
commit 7599b8b856
7 changed files with 30 additions and 11 deletions

View File

@@ -3,13 +3,13 @@ package mongo
import "log"
type Query struct {
Filter map[string]any
Filter map[string]any `json:"filter"`
}
type Filter struct {
Name string
Op string
Value string
Name string `json:"name"`
Op string `json:"op"`
Value string `json:"value"`
}
func makeFilter(name string, value any) *Filter {
@@ -64,7 +64,7 @@ func Mongofy(q *Query) map[string]any {
}
if len(conditions) == 0 {
return nil
return map[string]any{}
}
if logic == "or" {