Skip to content

Commit

Permalink
Merge pull request #105 from pinguo/ft_iter41_merge-mongodb
Browse files Browse the repository at this point in the history
add pipone
  • Loading branch information
pinguo-guzhongzhi authored Sep 23, 2024
2 parents 4667a6c + c30d02b commit 096d56b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions adapter/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package adapter
import (
"context"
"fmt"
"log"

"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"
Expand Down Expand Up @@ -184,7 +185,7 @@ func (m *Mongodb) UpsertIdCtx(ctx context.Context, id interface{}, replacement i
func handleOptions(query qmgo.QueryI, options ...bson.M) (qmgo.QueryI, error) {
opts := make(map[string]interface{})
for _, opt := range options {
if opt == nil || len(opt) == 0 {
if len(opt) == 0 {
continue
}
for k, v := range opt {
Expand All @@ -198,7 +199,7 @@ func handleOptions(query qmgo.QueryI, options ...bson.M) (qmgo.QueryI, error) {
case []string:
query.Sort(sort.([]string)...)
default:
return nil, fmt.Errorf("invalid mongo sort:%#v", sort)
log.Println(fmt.Errorf("invalid mongo sort:%#v", sort))
}
}
number := func(name string) (int64, error) {
Expand Down

0 comments on commit 096d56b

Please sign in to comment.