How to get perticular object from an array by its slug which is defined in mongoose schema
const express = require('express');
router.get('/:slug', async (req, res) => {
const post = await Posts.findOne({ slug: req.params.slug })
const comments = await Comment.find({})
res.render('posts/show', { post:post, comments:comments });
})