mongoose syntax code example
Example 1: findbyid mongoose
// Find the adventure with the given `id`, or `null` if not found
await Adventure.findById(id).exec();
// using callback
Adventure.findById(id, function (err, adventure) {});
// select only the adventures name and length
await Adventure.findById(id, 'name length').exec();
Example 2: mongoose add document
const Product = require('../models/product.js');
const product = new Product();
product.save()
.then(doc => {})
.catch(err => {});