+ 2
TypeError: req.next is not a function
Trying to practice Mongoose delete document by creating a delete page, which shows all todo-items. Here is my current app.get("/delete") https://code.sololearn.com/W41lckb7hQL2/?ref=app I don't know how to get all documents from all collections, so stupidly using for loop, but then can't res.render in find callback like app.get("/list") Got titled error... If commented out res.render and keep console.log, all documents are loaded into fulltodolist successfully.
5 odpowiedzi
+ 2
yeah, chaining then within variable length of promise is impossible.
you can use async/await ( https://code.sololearn.com/W6ETN0lznWvb/?ref=app [i havent tested it] ) to replace then. exec() is used to return a Promise, so we can use async and await.
kinda like this
https://code.sololearn.com/WUutQ8OC3xhy/?ref=app
0
i'm not fully understand, so you want to get all the data with name listed in todoListNames ?
0
Yes todoListNames are the Collection names.
I want to get all Document from all Collection.
Which I already did.
But how to pass them into the view engine?
where should i res.render()?
for single page, i do it like this:
https://code.sololearn.com/WVe18BrqW0Bq/?ref=app
put render in callback of find
0
I see.
Let me try tomorrow ~
Thanks~
0
Taste
at last, i solved with a for loop 😅
https://code.sololearn.com/W3uH2cQK7l48/?ref=app