{"record":{"id":"ca368c9f9e96d2ed","repo":"googleapis/mcp-toolbox","slug":"unable-to-unmarshal-filter-string-w","errorCode":null,"errorMessage":"unable to unmarshal filter string: %w","messagePattern":"unable to unmarshal filter string: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/mongodb/mongodb.go","lineNumber":233,"sourceCode":"func (s *Source) InsertOne(ctx context.Context, jsonData string, canonical bool, database, collection string) (any, error) {\n\tvar data any\n\terr := bson.UnmarshalExtJSON([]byte(jsonData), canonical, &data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := s.MongoClient().Database(database).Collection(collection).InsertOne(ctx, data, options.InsertOne())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.InsertedID, nil\n}\n\nfunc (s *Source) UpdateMany(ctx context.Context, filterString string, canonical bool, updateString, database, collection string, upsert bool) ([]any, error) {\n\tvar filter = bson.D{}\n\terr := bson.UnmarshalExtJSON([]byte(filterString), canonical, &filter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to unmarshal filter string: %w\", err)\n\t}\n\tvar update = bson.D{}\n\terr = bson.UnmarshalExtJSON([]byte(updateString), false, &update)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to unmarshal update string: %w\", err)\n\t}\n\n\tres, err := s.MongoClient().Database(database).Collection(collection).UpdateMany(ctx, filter, update, options.UpdateMany().SetUpsert(upsert))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error updating collection: %w\", err)\n\t}\n\treturn []any{res.ModifiedCount, res.UpsertedCount, res.MatchedCount}, nil\n}\n\nfunc (s *Source) UpdateOne(ctx context.Context, filterString string, canonical bool, updateString, database, collection string, upsert bool) (any, error) {\n\tvar filter = bson.D{}\n\terr := bson.UnmarshalExtJSON([]byte(filterString), false, &filter)\n\tif err != nil {","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/mongodb/mongodb.go#L215-L251","documentation":"Error \"unable to unmarshal filter string: %w\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/sources/mongodb/mongodb.go:233 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}