H
H
Hiroshima2020-10-31 16:20:44
Node.js
Hiroshima, 2020-10-31 16:20:44

Why doesn't the command to output elements to the console work?

node populatedb <your mongodb url>
The script should run to the end, displaying the created elements in the terminal.
5f9d64346c36a460033853.png

I follow the example from https://developer.mozilla.org/ru/docs/Learn/Server... I did everything as it is written there, but I used my own instead of the cloud database, that is, mongodb launched on my pc.

var mongoose = require('mongoose');
var mongoDB = 'mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb'; 
mongoose.connect(mongoDB);
mongoose.Promise = global.Promise;
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question