title: Please help me implement the logic code for depositing and withdrawing in node.js and mongodb
body: <p>am creating the logic that allows user to deposit money and withdraw money in node.js with mongodb. But I try my little knowledge to make it works, and I can't seems to bring the logic correctly. below is my code that I'm trying to deposit please help me as mynknowledge seems insufficient curently.</p>
  <p>Below is code:</p>
  <pre><code>  import User from &quot;../models/user.js&quot;
  
  export const depositSlip = async (req, res) =&gt; {
      const { accountNo, name, amount } = req.body;
      
      try {
          
          const deposit = await User.findOne({ accountNo, name });
  
          if(!accountNo === name ) {
              return res.status(404).json({ message: &quot;Account details does not match&quot; }) 
          } else {
              deposit
          }
          
          if (!deposit) return res.status(404).json({ message: &quot;Account Number does not exsit&quot; }) 
  
          await deposit.save({ amount })
          
      } catch (err) {
          
      }
  }
  </code></pre>
  <p>please I don't even know if I'm creating the logic right but please take it as if you are teaching some one a new and guide me through.</p>
  <p>And as for the withdrawal code, I don't even implement it because I haven't finished the depositing cod first.
  please come to my rescue, I know am asking a a lot from you of your time, but this is really important for me to create this.
  So, please help
  Thank you.</p>