File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ func _switch(documents interface{}) ([]any, error) {
472472 var docSlice []any
473473 switch raw .Type {
474474 case bson .TypeArray :
475- elems , err := raw .Array (). Values ()
475+ elems , err := bson . Raw ( raw .Array ()). Elements ()
476476 if err != nil {
477477 return nil , fmt .Errorf ("invalid documents: %w" , err )
478478 }
@@ -483,11 +483,7 @@ func _switch(documents interface{}) ([]any, error) {
483483
484484 docSlice = make ([]any , len (elems ))
485485 for i , elem := range elems {
486- var doc any
487- if err := bson .Unmarshal (elem .Value , & doc ); err != nil {
488- return nil , fmt .Errorf ("failed to unmarshal document: %w" , err )
489- }
490- docSlice [i ] = doc
486+ docSlice [i ] = elem .Value ().Document ()
491487 }
492488 default :
493489 return nil , fmt .Errorf ("invalid documents: %w" , ErrNotSlice )
You can’t perform that action at this time.
0 commit comments