Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

Why Doesn't This Collection Automatically Show Up in my MongoDB?

Here's a portion of my app.js file:

const express = require("express");
const jwt = require("jsonwebtoken"); //this is the package that decrypts your token
const mongoose = require("mongoose");
//const compression = require("compression");

const app = express();
const superPassword = process.env.SIGNATURE; //here's where you're grabbing your SIGNATURE constant from your .env file that's in your root directory
const conn = process.env.CONNECTION;

const Auth = require("./models/auth");

Open in new window


Here's my "auth.js" model:

const mongoose = require("mongoose");

const Schema = mongoose.Schema;

const authSchema = new Schema({
  app: {
    type: String,
    required: true
  },
  token: {
    type: String,
    required: true
  }
});

module.exports = mongoose.model("Auth", authSchema);

Open in new window


I'm expecting to see a new "auth" collection in my MongoDB but I'm not seeing it.

Am I missing something?
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

noci, you were more on point than you know. I inserted a row using the model that I instantiated at the top of the script and once the table was actually engaged, it kicked into gear!
BOOM!
Avatar of noci
noci

no problem. thanx.