Mongodb Setup

[Solved] Mongodb Setup | Sql - Code Explorer | yomemimo.com
Question : mongoose setup

Answered by : helpless-hippopotamus-mpdm5cbl8tla

// getting-started.js
const mongoose = require('mongoose');
mongoose.connect("mongodb://localhost:27017/name", { useUnifiedTopology: true, useNewUrlParser: true });

Source : https://mongoosejs.com/docs/ | Last Update : Thu, 16 Jul 20

Question : install mongodb

Answered by : chukwujiobi-canon

# You can easily install mongodb to run locally on your windows machine using chocolatey
# run
$ choco install mongodb
# to properly set up, add the mongodb path -- in my case it is; C:\Program Files\MongoDB\Server\5.3\bin -
# to your system environment variables
# then test your installation
$ mongo --version
# expected output
# MongoDB shell version vx.y.z
# Build Info: {
# "version": "x.y.z",
# "gitVersion": "ea201bb0ab5fa4c9c9d27c29a538987db15c0a36",
# "modules": [],
# "allocator": "tcmalloc",
# "environment": {
# "distmod": "windows",
# "distarch": "x86_64",
# "target_arch": "x86_64"
# }
#}

Source : | Last Update : Thu, 30 Jun 22

Question : MongoDB Setup

Answered by : eric-tam

in <project-name>/app.js
var app = express();
/*....*/
//////mongoose
// Set up mongoose connection
var mongoose = require('mongoose');
var dev_db_url = 'mongodb+srv://<username>:<password>@cluster0.sekti.mongodb.net/example?retryWrites=true&w=majority';
var mongoDB = process.env.MONGODB_URI || dev_db_url;
const uri = process.env.MONGODB_URI;
mongoose.connect(mongoDB, {useNewUrlParser: true, useUnifiedTopology: true});
mongoose.Promise = global.Promise;
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));
//////
///replace <username> and <password> with your actual username and password of course

Source : | Last Update : Thu, 04 Aug 22

Answers related to mongodb setup

Code Explorer Popular Question For Sql