Answer the question
In order to leave comments, you need to log in
How to connect to mongoose in digital ocean?
Hello. I am learning JS stack. I set up a node, express, passport, I already figured out a bit with routing and auth. Now I want to try to save this data in the database. I have not worked with mongodb before, I want to ask how I can connect to it.
First I installed mongodb as it says on the site. mongodbInstall Everything works writes running.
Then I installed mongoose.
In the app.js file I write this
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
Answer the question
In order to leave comments, you need to log in
leave just localhost, mongoose will determine itself, as described here:
mongoosejs.com/docs/connections.html
Moreover, the server port is 3000, but they write another one in mongo.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question