title: How to count the number of views on a post
body: <p>I am trying to make a website containing posts so I have a 'Read more' link which expands the content there and there only like quora. How do I know the total number of times it has been clicked so that I can display the views?</p>
  <p>I am using nodejs, express and mongodb as the server.</p>
  <p>This is my hbs (handlebars) file with that read more link</p>
  <pre><code>    &lt;p class=&quot;startPara&quot;&gt;{{stripTags (truncate body 200)}}&lt;span class=&quot;dots&quot; &gt;... 
      &lt;/span&gt;&lt;/p&gt;
      &lt;span class=&quot;content&quot;&gt;
      &lt;p&gt;{{stripTags (truncate body 400)}}&lt;/p&gt;
      &lt;/span&gt;
      &lt;a onclick=&quot;readMoreFunction(this)&quot; class=&quot;buttonReadMore&quot; &gt;Read more&lt;/a&gt;
      &lt;/div&gt;
  </code></pre>
  <p>This is my main hbs file which executes all the js its script tags</p>
  <pre><code>    &lt;script&gt;
    function readMoreFunction(el) {
      var parent = el.closest(&quot;.wrapper&quot;)
      var dots = parent.querySelector(&quot;.dots&quot;);
      var contentText = parent.querySelector(&quot;.content&quot;);
      var btnText = parent.querySelector(&quot;.buttonReadMore&quot;);
      var startPara=parent.querySelector(&quot;.startPara&quot;);
  
    
  
      btnText.style.display = &quot;none&quot;;
        startPara.style.display= &quot;none&quot;;
        dots.style.display = &quot;none&quot;;
        contentText.style.display = &quot;inline&quot;;
      
    }
  
  &lt;/script&gt;
  </code></pre>
  <p>Now every post is unique clicked by a unique user so just incrementing a variable won't help.</p>
  <p>So please tell me how to calculate the total number of times that link has been clicked for a specific post and then how to communicate it to the database so that I can display it on the webpage</p>