fix: fix the mongo search error (#1736)

* fix: improve the GetSortedConversation api

* fix: fix the go.mod

* fix: fix the valiable name

* fix: the FindUser error

* fix: fix the mongo search
pull/1742/head
Brabem 11 months ago committed by GitHub
parent 1c72e46cc9
commit 04c77bff7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -83,7 +83,7 @@ func (u *UserMgo) PageFindUser(ctx context.Context, level int64, pagination pagi
} }
func (u *UserMgo) GetAllUserID(ctx context.Context, pagination pagination.Pagination) (int64, []string, error) { func (u *UserMgo) GetAllUserID(ctx context.Context, pagination pagination.Pagination) (int64, []string, error) {
return mgoutil.FindPage[string](ctx, u.coll, bson.M{}, pagination, options.Find().SetProjection(bson.M{"user_id": 1})) return mgoutil.FindPage[string](ctx, u.coll, bson.M{}, pagination, options.Find().SetProjection(bson.M{"_id": 0, "user_id": 1}))
} }
func (u *UserMgo) Exist(ctx context.Context, userID string) (exist bool, err error) { func (u *UserMgo) Exist(ctx context.Context, userID string) (exist bool, err error) {
@ -91,7 +91,7 @@ func (u *UserMgo) Exist(ctx context.Context, userID string) (exist bool, err err
} }
func (u *UserMgo) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error) { func (u *UserMgo) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error) {
return mgoutil.FindOne[int](ctx, u.coll, bson.M{"user_id": userID}, options.FindOne().SetProjection(bson.M{"global_recv_msg_opt": 1})) return mgoutil.FindOne[int](ctx, u.coll, bson.M{"user_id": userID}, options.FindOne().SetProjection(bson.M{"_id": 0, "global_recv_msg_opt": 1}))
} }
func (u *UserMgo) CountTotal(ctx context.Context, before *time.Time) (count int64, err error) { func (u *UserMgo) CountTotal(ctx context.Context, before *time.Time) (count int64, err error) {

Loading…
Cancel
Save