Ошибка при выводе данных из массива в handlebars, что не так?

Цикл:

<div class="sale">
<div class="container">
    {{#if products.length}}
        <div class="wrapper">
            <div class="block-filters">
                <ul class="block-filters-list">
                    <li data-size="big">
                        <a data-size="big" href="#">Мужское</a>
                    </li>
                    <li data-size="big">
                        <a data-size="big" href="#">Unisex</a>
                    </li>
                    <li data-size="big">
                        <a data-size="big" href="#">Женское</a>
                    </li>
                    <li data-size="big">
                        <a data-size="big" href="#">Большой размер</a>
                    </li>
                    <li data-size="small">
                        <a data-size="small" href="#">Маленький размер</a>
                    </li>
                    <li data-size="all">
                        <a data-size="all" href="#">Все товары</a>
                    </li>
                </ul>
            </div>
            <ul class="list-cards">
                {{#each products}}
                    <li class="card" data-size="{{size}}">
                        <a href="/products/{{id}}" title="{{title}}">
                            <div class="card__block-img">
                                <figure>
                                    <img src="{{img}}" alt="{{title}}">
                                </figure>
                            </div>
                            <div class="card__description">
                                <span class="card-name">{{title}}</span>
                                <div class="card__block-price">
                                    <span class="card-old-price">{{oldPrice}}</span>
                                    <span class="card-now-price">{{nowPrice}}</span>
                                    <span class="card-sale">{{sale}}</span>
                                </div>
                            </div>
                        </a>
                    </li>
                {{/each}}
            </ul>
        </div>
    {{else}}
        <p class="nothing">Товаров не найдено</p>
    {{/if}}
</div>

Ошибка: Handlebars: Access has been denied to resolve the property "size" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details Handlebars: Access has been denied to resolve the property "id" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details Handlebars: Access has been denied to resolve the property "title" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details Handlebars: Access has been denied to resolve the property "img" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details Handlebars: Access has been denied to resolve the property "oldPrice" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details Handlebars: Access has been denied to resolve the property "nowPrice" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details Handlebars: Access has been denied to resolve the property "sale" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

Хотя я выводил в консоль, что такое products:

[
  {
    _id: 5f5508540e87a66fe2c3485d,
    img: '/img/IMG_2217.jpg',
    title: 'Серая кофта',
    nowPrice: 3000,
    oldPrice: 0,
    sale: 0,
    size: 'X'
  },
  {
    _id: 5f5509dc0e87a66fe2c3485f,
    img: '/img/IMG_2218.jpg',
    title: 'Черная кофта',
    nowPrice: 5000,
    oldPrice: 9000,
    sale: 50,
    size: 'S'
  }
]


Ответы (1 шт):

Автор решения: user407031

Нужно было бы еще показать кусок кода с роутами. Могу предложить самое простое решение данной проблемы, по крайней мере у меня сработало.(только с mongoose) Добавление метода .lean(). Примерно так

router.get('/', async (req, res) => {
    const res = await Course.find((err, res) => {
        if(err) {
            throw err;
        } else {
            console.log(res);
        }
    }).lean();
    
    res.render('res', {
        title: 'Res',
        res
    });
});
→ Ссылка