Browse Source

add sort for seach doc

animeic 2 years ago
parent
commit
176a8f0840
1 changed files with 3 additions and 0 deletions
  1. 3 0
      boxcost/db/repo/repo.go

+ 3 - 0
boxcost/db/repo/repo.go

@@ -229,6 +229,9 @@ func RepoSeachDocMap(ctx *RepoSession, param *DocSearchOptions) (bool, map[strin
 		}
 		opt.SetProjection(prj)
 	}
+	if len(param.Sort) > 0 {
+		opt.Sort = param.Sort
+	}
 	filter := bson.M{}
 	if len(param.Query) > 0 {
 		for k, v := range param.Query {