Here "user" is a collection of usernames, email, password, and an array of id. These ids belong to a collection "urllist".when I am doing console.log(resp.urlslist)
it is giving an array of objects. but when passing the same result using res.render("finalsite",{linklist:resp.urlslist})
then urlslist
is null error is occurring:
app.get("/finalsite/:use", function (req, res) {
user.findOne({username:req.params.use})
.populate("urlslist")
.exec()
.then((resp) => {
console.log(resp.urlslist);
res.render("finalsite",{ linklist:resp.urlslist });
})
.catch((err) => {
console.log(err);});
});
Aucun commentaire:
Enregistrer un commentaire