From e81356bff8b71ca1244a3d7e0cdca383969c0083 Mon Sep 17 00:00:00 2001 From: Rethakgetse-Manaka Date: Thu, 20 Jun 2024 11:44:52 +0200 Subject: [PATCH] Fix implemented --- occupi-backend/pkg/database/database.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/occupi-backend/pkg/database/database.go b/occupi-backend/pkg/database/database.go index 06518651..0fe49011 100644 --- a/occupi-backend/pkg/database/database.go +++ b/occupi-backend/pkg/database/database.go @@ -380,18 +380,20 @@ func GetAllRooms(ctx *gin.Context, db *mongo.Client, floorNo int) ([]models.Room var cursor *mongo.Cursor var err error - findOptions := options.Find() - findOptions.SetLimit(10) // Limit the results to 10 - findOptions.SetSkip(int64(10)) // Skip the specified number of documents for pagination + // findOptions := options.Find() + // findOptions.SetLimit(10) // Limit the results to 10 + // findOptions.SetSkip(int64(10)) // Skip the specified number of documents for pagination if floorNo == 0 { // Find all rooms filter := bson.M{"floorNo": 0} - cursor, err = collection.Find(context.TODO(), filter, findOptions) + // cursor, err = collection.Find(context.TODO(), filter, findOptions) + cursor, err = collection.Find(context.TODO(), filter) } else { // Find all rooms on the specified floor filter := bson.M{"floorNo": floorNo} - cursor, err = collection.Find(context.TODO(), filter, findOptions) + // cursor, err = collection.Find(context.TODO(), filter, findOptions) + cursor, err = collection.Find(context.TODO(), filter) } if err != nil {