maximum log
This commit is contained in:
parent
e2f722e17b
commit
8c3b92143e
@ -3,6 +3,7 @@ package mongo
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -252,8 +253,11 @@ func (m *MongoDB) Search(search string, filter []string, collection_name string)
|
||||
MngoCtx, bson.M{"$or": list},
|
||||
opts,
|
||||
); err != nil {
|
||||
fmt.Println(0, bson.M{"$or": list})
|
||||
return nil, 404, err
|
||||
} else {
|
||||
fmt.Println(cursor, bson.M{"$or": list})
|
||||
|
||||
return cursor, 200, nil
|
||||
}
|
||||
}
|
||||
@ -289,3 +293,24 @@ func (m *MongoDB) LoadAll(collection_name string) (*mongo.Cursor, int, error) {
|
||||
}
|
||||
return res, 200, nil
|
||||
}
|
||||
|
||||
func (m *MongoDB) toOperator(operator string) string {
|
||||
if operator == "like" {
|
||||
return "$regex"
|
||||
} else if operator == "exists" {
|
||||
return "$exists"
|
||||
} else if operator == "in" {
|
||||
return "$in"
|
||||
} else if operator == "gte" {
|
||||
return "$gte"
|
||||
} else if operator == "gt" {
|
||||
return "$gt"
|
||||
} else if operator == "lte" {
|
||||
return "$lte"
|
||||
} else if operator == "lt" {
|
||||
return "$lt"
|
||||
} else if operator == "eq" {
|
||||
return "$match"
|
||||
}
|
||||
return operator
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user