how to insert data in a collection document of a database using mongoose code example
Example 1: mongoose add document
const Product = require('../models/product.js');
const product = new Product();
product.save()
.then(doc => {})
.catch(err => {});
Example 2: insert a data into mongo using express
var mongoose = require("mongoose");mongoose.Promise = global.Promise;mongoose.connect("mongodb://localhost:27017/node-demo");