title: Why am I returning null when I patch my data
body: <p>I am patching my data, but when I do that my data ends up with the value of <code>null</code>. I even <code>console.log</code> the value that I am sending to my database and I get the correct value, but for some reason in my database it is showing up as null.</p>
  <pre class="lang-none prettyprint-override"><code>,    &quot;going&quot;:null, &quot;date&quot;:&quot;2020-11-10T17:34:11.135Z&quot;, &quot;__v&quot;:0},
  ivs&quot;,&quot;going&quot;:2,    &quot;date&quot;:&quot;2020-11-11T04:19:24.433Z&quot;, &quot;__v&quot;:0}]
  </code></pre>
  <p>As you can see, &quot;going&quot; should have an integer as its value, but instead the one that I patched shows <code>null</code>.</p>
  <p>Any suggestions on how to fix this?</p>
  <pre class="lang-js prettyprint-override"><code>import React from &quot;react&quot;;
  import &quot;./App.css&quot;;
  import axios from &quot;axios&quot;;
  
  export default class Scroll extends React.Component {
      state = {
          posts: [],
          id: 0,
      };
  
      componentDidMount() {
          axios.get(&quot;http://localhost:5000/posts/save&quot;).then((res) =&gt; {
              const posts = res.data;
              this.setState({ posts });
          });
      }
  
      handleClick = (id) =&gt; {
          var i;
          for (i = 0; i &lt; this.state.posts.length; i++) {
              if (this.state.posts[i]._id === id) {
                  let x = this.state.posts[i].going + 1;
                  axios({
                      url: `http://localhost:5000/posts/save/${id}`,
                      method: &quot;PATCH&quot;,
                      data: x,
                  })
                      .then(() =&gt; {
                          console.log(x);
                      })
                      .catch(() =&gt; {
                          console.log(&quot;Internal server error&quot;);
                      });
              }
          }
      };
  
      render() {
          return (
              &lt;div className=&quot;flex-container&quot;&gt;
                  {this.state.posts.reverse().map((posts) =&gt; (
                      &lt;div className=&quot;post&quot;&gt;
                          &lt;h3 id=&quot;post-text&quot;&gt;{posts.title}&lt;/h3&gt;
                          &lt;p id=&quot;post-text&quot;&gt;{posts.body}&lt;/p&gt;
                          &lt;p&gt;{posts.going}&lt;/p&gt;
                          &lt;button onClick={() =&gt; this.handleClick(posts._id)}&gt;Going&lt;/button&gt;
                      &lt;/div&gt;
                  ))}
              &lt;/div&gt;
          );
      }
  }
  </code></pre>