diff --git a/internal/app/collection_find.go b/internal/app/collection_find.go index fc7fc84..8441614 100644 --- a/internal/app/collection_find.go +++ b/internal/app/collection_find.go @@ -47,7 +47,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey string, formJson string) findRes var projection bson.M var sort bson.M - err = json.Unmarshal([]byte(form.Query), &query) + err = bson.UnmarshalExtJSON([]byte(form.Query), true, &query) if err != nil { fmt.Println(err.Error()) runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{ diff --git a/internal/app/collection_insert.go b/internal/app/collection_insert.go index 19ddfc8..72765e1 100644 --- a/internal/app/collection_insert.go +++ b/internal/app/collection_insert.go @@ -1,11 +1,11 @@ package app import ( - "encoding/json" "fmt" "strings" "github.com/wailsapp/wails/v2/pkg/runtime" + "go.mongodb.org/mongo-driver/bson" ) func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{} { @@ -16,7 +16,7 @@ func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{} jsonData = "[" + jsonData + "]" } - err := json.Unmarshal([]byte(jsonData), &data) + err := bson.UnmarshalExtJSON([]byte(jsonData), true, &data) if err != nil { fmt.Println(err.Error()) runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{ diff --git a/internal/app/collection_remove.go b/internal/app/collection_remove.go index ee9aa05..56f36db 100644 --- a/internal/app/collection_remove.go +++ b/internal/app/collection_remove.go @@ -1,7 +1,6 @@ package app import ( - "encoding/json" "fmt" "strings" @@ -27,7 +26,7 @@ func (a *App) RemoveItems(hostKey, dbKey, collKey, jsonData string, many bool) i return 0 } } else { - err = json.Unmarshal([]byte(jsonData), &filter) + err = bson.UnmarshalExtJSON([]byte(jsonData), true, &filter) if err != nil { fmt.Println(err.Error()) runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{ diff --git a/internal/app/collection_update.go b/internal/app/collection_update.go index a83158e..3e5a67d 100644 --- a/internal/app/collection_update.go +++ b/internal/app/collection_update.go @@ -43,7 +43,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64 var query bson.M update := bson.M{} - err = json.Unmarshal([]byte(form.Query), &query) + err = bson.UnmarshalExtJSON([]byte(form.Query), true, &query) if err != nil { fmt.Println(err.Error()) runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{