Install and set up Mongoose: test is failing

Tell us what’s happening:
There are a number of errors:

  1. Where can the <dbname> be found so that it can be replaced in the connection string?

In https://www.freecodecamp.org/learn/apis-and-microservices/mongodb-and-mongoose/ it states:

Blockquote:
Notice that the user and cluster#-dbname fields are already filled out for you, so all you would need to replace is the password field with the one that you created in the previous step.

However, it does not appear that <dbname> actually has been automatically filled out in this connection string provided by Mongodb Atlas:
mongodb+srv://super:<password>@cluster0.nfaii.mongodb.net/<dbname>?retryWrites=true&w=majority

Therefore, how can the dbname to replace <dbname> be found?

Also, it appears that the entire string: <dbname>, including the the less than and greater than, is to be replaced in the connection string, right?

  1. Further, the although the mongodb, and mongoose packages have been added to the package.json file as shown here, the test is stating the following:
{
	"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",
		"express": "^4.12.4",
		"mongoose": "^5.9.20",
		"mongodb": "^3.6.2"
	},
	"engines": {
		"node": "4.4.5"
	},
	"repository": {
		"type": "git",
		"url": "https://hyperdev.com/#!/project/welcome-project"
	},
	"keywords": [
		"node",
		"hyperdev",
		"express"
	],
	"license": "MIT"
}

// running tests "mongodb" dependency should be in package.json "mongoose" dependency should be in package.json "mongoose" should be connected to a database // tests completed

Your code so far
https://repl.it/@controlunit/boilerplate-mongomongoose#package.json

Your browser information:

Chromium

Challenge: Install and Set Up Mongoose

Link to the challenge:

The dbName is (by default) Cluster0
You must keep less than and greater than for dbName but not for the password

Thanks.

However, although mongodb and mongoose have been added to the package.json as shown in the opening post, the test is failing with:

// running tests
"mongodb" dependency should be in package.json
"mongoose" dependency should be in package.json
"mongoose" should be connected to a database
// tests completed

Hello there,

You still need to require mongoose, and use process.env.MONGO_URI to access your DB string.

Have you created a .env file?

Did you call mongoose.connect(…) in myApp.js ?
Did tou write your URI in .env ? (or in myApp just for testing) ?
if you call mongoose.connect(…)
try to npm uninstall mongodb mongoose --save and after npm install mongoose mongodb --save

This solution worked, thanks!

It is not readily apparent how to write the connection string. Apparently, the less than and greater than is supposed to be kept in the connection string for <dbname> but not for <password>. Also, the name of the dbname is Cluster0.

Working:

In myApp.js:

var mongoose = require('mongoose');

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

Connection string in .env:

MONGO_URI="mongodb+srv://super:some_strong_password@cluster0.nfaii.mongodb.net/<Cluster0>?retryWrites=true&w=majority"

Repl.it is being used, it appears that Repl handles the mongodb and mongoose installs when the Run button is clicked, as long as these are present in the package.json file.