diff --git a/app/properties/page.jsx b/app/properties/page.jsx index b5149af..34bd4c0 100644 --- a/app/properties/page.jsx +++ b/app/properties/page.jsx @@ -3,9 +3,12 @@ import PropertySearchForm from '@/components/PropertySearchForm'; import Property from '@/models/Property'; import connectDB from '@/config/database'; -const PropertiesPage = async () => { +const PropertiesPage = async ({ searchParams: { pageSize = 3, page = 1 } }) => { await connectDB(); - const properties = await Property.find({}).lean(); + const skip = (page - 1) * pageSize; + + const total = await Property.countDocuments({}); + const properties = await Property.find({}).skip(skip).limit(pageSize); return ( <>