title: how to store and validate qr code in server using nodejs and mongoose
body: <p>We are implementing a mobile app using the following technologies:</p>
  
  <ul>
  <li><p>Node.JS &amp; express </p></li>
  <li><p>MongoDB &amp; mongoose</p></li>
  <li><p>Flutter</p></li>
  </ul>
  
  <p>Suppose we should generate QR Code with the goods information like name, price, expiration date and etc. which should be unique and whenever customer scan the QR Code it should be validated by connecting to the server, fetching data and add the selected good to cart.</p>
  
  <p>As I have searched on the internet, I found that we should convert the data to canvas (to have QR Code). Is there any solution to generate QR code in server side, store and validate it in mongodb? </p>
  
  <p>Here is our product.js file:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var productSchema = new Schema({
      productID: {
          type: mongoose.Schema.Types.ObjectId,
          required: true
      },
      name: {
          type: String,
          required: true,
          trim: true
      },
      expirationDate: {
          type: Date,
          required: true
      },
      price: {
          type: Number,
          required: true,
          trim: true
      },
      discount: {
          type: Number,
          default: 0,
          trim: true
      },
      producer: {
          type: String,
          required: true
      },
      QRCode: {
          type: String,
          required: true
      }
  })
  
  var Product = mongoose.model('Product', productSchema);
  module.exports = Product;
  </code></pre>