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);
}
})
let order = await Order.findOne({orderId: ctx.params.id}, {createdAt: 1, _id: 0}).toArray();