I want to see the Code that gets executed when Customer.create gets called but I don't know how I can analyse the code of the mongoose module.
So far i understand that require('mongoose) will lookup in the node_modules folder for the mongoose folder. This mongoose Folder has a package.json that reference with a main key to an index.js file inside the mongoose folder.
This is the index.js file:
'use strict';
module.exports = require('./lib/');
require will look in the ./lib/ folder for an index.js. This is a big file and i don't know how i can proceed in order to understand what the create function is doing.
How would an expert check what the create function is doing exactly?
//app.js
require("dotenv").config();
const mongoose = require('mongoose');
const Customer = require('./models/Customer');
const start = async () => {
  const db = await mongoose.connect(process.env.MONGO_URI);
  try {
    const customer = await Customer.create([{ firstName: "john" }], { session: session });
  } catch (error) {
    console.error(error);
  }
};
start();
//Customer.js
const mongoose = require('mongoose');
const CustomerSchema = new mongoose.Schema({ firstName: { type: String } });
module.exports = mongoose.model('Customer', CustomerSchema);
