N
N
Nikita Shchypylov2018-06-29 17:02:17
MongoDB
Nikita Shchypylov, 2018-06-29 17:02:17

Why does Infinite Load appear with such a search for positions in MongoDB?

Hello.
This option works. When I request the url, the data is immediately returned to me:

ShopSchema.find(function (err, data) {
        if (err) {
            console.log(err);
        }
        else {
            res.json(data);
        }
    });

And with this, the site just loads endlessly:
ShopSchema.find((data, err) => {
        if (err) {
            console.log("--- ", err);
        } else {
            return res.json(data)
        }
    });

Why?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Interface, 2018-06-29
@Nikulio

You have err and data mixed up in the second option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question