Skip to content

Commit de28eb4

Browse files
committed
fix for search for accepted posts
1 parent 09493a9 commit de28eb4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/db/db.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,8 @@ func GetAllTags(ctx context.Context, db *mongo.Database) ([]string, error) {
479479
func GetUserAcceptedPostsByUserId(ctx context.Context, db *mongo.Database, userId string) ([]models.Post, error) {
480480
collection := db.Collection("posts")
481481

482-
// Find all posts where acceptedUser.userId matches the provided userId
483-
cursor, err := collection.Find(ctx, bson.M{"acceptedUser.userId": userId})
482+
// Find all posts where acceptedUser.userId matches the provided userId -> userid is small because mongo internal
483+
cursor, err := collection.Find(ctx, bson.M{"acceptedUser.userid": userId})
484484
if err != nil {
485485
return nil, fmt.Errorf("failed to find accepted posts by userId: %w", err)
486486
}

0 commit comments

Comments
 (0)