Pug Error: Cannot read properties of undefined (reading ‘length’)

I am making a small website with Node.js, Express, Pug and MongoDB. I am trying to get a page to render but keep running into this error. The page renders data that is pulled from the database, and I am using a foreach loop to order to show all the data.

The function is filtering the data to select all data that contains { section: ‘mens’ }; as the page is a part of a clothing store site, showing only men’s clothes.

I have checked the function separately and it works, yet I still get an error when rendering it with Pug, which makes me believe there is an issue there.

Here is my function to get the filtered data from my MongoDB database.

async function showMenOffers() {
    db = await connection();
    let query = { section: "men" };
    let filter = await db.collection('offerings').find(query).toArray();
    return filter;
}

Here is the code when I attempt to render it:

router.get("/mens", async (request, response) => {
    let offers = await model.showMenOffers();
    response.render("/mens", { title: "Mens", view: offers });
});

And lastly the Pug code:

block layout-content 
    h1(class="display-2") Mens 
    table(class="table table-secondary table-bordered table-stripped-columns my-5 border border-black") 
        thead 
            tr 
                th(scope="col") Product 
                th(scope="col") Gender 
        tbody 
            if view.length > 0
                each offer in view 
                    tr 
                        td #{offer.size} #{offer.color} #{offer.name}
                        td #{offer.section}
            else 
                tr 
                    td(colspan="2") No offers available

I find myself lost on what next step to take. I’ve checked that the function works, I’ve checked for spelling errors as well and can’t find any.