"mongoose" not connected to a database

Tell us what’s happening:
Hi team - I spent some time looking at this and cannot find out why it’s not connecting to the mongoose database - glitch linked below. Any guidance is greatly appreciated!

Your project link(s)

solution: https://salt-graceful-piccolo.glitch.me

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36.

Challenge: Install and Set Up Mongoose

Link to the challenge:

Hi @avian21u

Welcome to the FCC forum. The link is not for the glitch project. It is therefore difficult to tell why your app is not connecting to the DB.

Oh, I realized the glitch link doesn’t show the underlying link. This is what I have in Glitch - would this be helpful?

mongo.env:

MONGO_URI="mongodb+srv://myusername:myactualpassword@cluster0.tay1m.mongodb.net/sample_airbnb?retryWrites=true&w=majority"

myApp.js:

require('dotenv').config();

const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });

package.json:

{
  "name": "fcc-mongo-mongoose-challenges",
  "version": "0.0.1",
  "description": "A boilerplate project",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "body-parser": "^1.15.2",
    "dotenv": "^8.2.0",
    "express": "^4.12.4",
    "mongodb": "^3.6.6",
    "mongoose": "^5.12.4"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/freeCodeCamp/boilerplate-mongomongoose.git"
  },
  "keywords": [
    "node",
    "mongoose",
    "express"
  ],
  "license": "MIT"
}

Nevermind, I re-cloned the git and imported into glitch and somehow it works.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.