title: How to decrease coins of users in MongoDB?
body: <p>I am a building a web-app where people have 10 coins by default, and when they click a buy button, it reduces the number of coins by 10 with each click.</p>
  <p>The schema for users is like this:</p>
  <pre class="lang-js prettyprint-override"><code>    const mongoose = require(&quot;mongoose&quot;);
      const UserSchema = new mongoose.Schema(
        {
          username: {
            type: String,
            require: true,
            min: 3,
            max: 20,
            unique: true,
          },
          email: {
            type: String,
            required: true,
            max: 50,
            unique: true,
          },
          password: {
            type: String,
            required: true,
            min: 6,
          },
          isAdmin: {
            type: Boolean,
            default: false,
          },
          coins: {
            type: Number,
            default: 10,
          },
        },
        { timestamps: true } 
      );
      
      module.exports=mongoose.model(&quot;User&quot;, UserSchema);
  </code></pre>
  <p><strong>How do I write a code to use a button to reduce the number of coins?</strong></p>