pointer of pointer is kicked out
This commit is contained in:
@@ -260,7 +260,7 @@ func (m *MongoDB) LoadOne(id string, collection_name string) (*mongo.SingleResul
|
||||
return res, 200, nil
|
||||
}
|
||||
|
||||
func (m *MongoDB) Search(filters dbs.Filters, collection_name string) (*mongo.Cursor, int, error) {
|
||||
func (m *MongoDB) Search(filters *dbs.Filters, collection_name string) (*mongo.Cursor, int, error) {
|
||||
if err := m.createClient(mngoConfig.GetUrl()); err != nil {
|
||||
return nil, 503, err
|
||||
}
|
||||
@@ -268,21 +268,21 @@ func (m *MongoDB) Search(filters dbs.Filters, collection_name string) (*mongo.Cu
|
||||
opts.SetLimit(100)
|
||||
targetDBCollection := CollectionMap[collection_name]
|
||||
orList := bson.A{}
|
||||
for k, filter := range filters.Or {
|
||||
orList = append(orList, bson.M{
|
||||
k: bson.M{dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value)}})
|
||||
}
|
||||
f := bson.D{
|
||||
{"$or", orList},
|
||||
}
|
||||
if len(orList) == 0 {
|
||||
f = bson.D{}
|
||||
}
|
||||
for k, filter := range filters.And {
|
||||
f = append(f, bson.E{
|
||||
k, bson.M{
|
||||
dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value),
|
||||
}})
|
||||
f := bson.D{}
|
||||
if filters != nil {
|
||||
for k, filter := range filters.Or {
|
||||
orList = append(orList, bson.M{
|
||||
k: bson.M{dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value)}})
|
||||
}
|
||||
if len(orList) > 0 {
|
||||
f = bson.D{{"$or", orList}}
|
||||
}
|
||||
for k, filter := range filters.And {
|
||||
f = append(f, bson.E{
|
||||
k, bson.M{
|
||||
dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value),
|
||||
}})
|
||||
}
|
||||
}
|
||||
|
||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
|
Reference in New Issue
Block a user