Answer the question
In order to leave comments, you need to log in
How to change the array that came from mongoose?
I can’t get it out, which I have changed now, writes that
TypeError: doc.map is not a function
.get('/order/:id', async(ctx) => {
try {
let order = await Order.findOne({orderId: ctx.params.id}).exec((err, doc) => {
doc.time = moment(doc.createdAt).local('ru').format('DD MMMM YYYY H:mm');
return doc;
});
console.log(order);
await ctx.render('order_view', {order});
} catch(err) {
await console.log(err);
}
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question