The mongo database is configured on the windows server and has been opened. Why is mongoose still unable to connect?

  node.js, question

The mongo database is configured on the windows server and has been opened. Why is mongoose still unable to connect?

var mongoose = require('mongoose');
 var Schema = mongoose.Schema;
 var models = require('./models');
 var db = mongoose.connect("mongodb://localhost:27017");
 db.connection.on("error",function(err){
 Log (link failure plus err)
 })
 db.connection.on("open",function(){
 Log ("link succeeded")
 })

Prompt fail to connect to server when linking.

The premise is that mongodb’s service is already on

Is it because win32’s mongodb version is too low, or is it due to other reasons? Ask for advice

I am also nodejs of window system, but I use express plus mongoose. In order to open the server conveniently, I have slightly modified the code in bin/www:

var exec = require('child_process').exec;
 exec('mongod --dbpath e:/mongodb/db', {
 cwd: 'e:/mongodb/bin'
 });

Before starting the server, start a sub-process to start the mongodb service.