title: How do I toggle boolean values in JSON object using express?
body: <p>I am a beginner and have just finished my first MERN CRUD app. I've thought about a few ways to improve the app. The app is a todo list and has a complete button. The complete button will score a line through an item in the todo list. The complete button triggers a function which will make a post request (shown below) to the nodejs/express backend server. When the "isCompleted" field in the Mongo model is set to "true" (by default it's false), the item will be scored out. I tried to find a way to toggle the boolean values in the "isCompleted" field, whenever the complete button is clicked. This way you can unscore an item. But I just couldn't figure out how to implement this. Any ideas?</p>
  
  <pre><code>exports.updateEntry = async (req, res, next) =&gt; {
  try {
      const entry = await Entry.findByIdAndUpdate({_id:req.params.id}, {isCompleted: true});
  
  
  
      return res.status(200).json({
          success: true,
          data: entry
      });
  
  } catch (err) {
      return res.status(500).json({
          success: false,
          error: 'Server Error'
      });
  }
  </code></pre>