打开后无法立即关闭连接尝试db.server.close()和server.close()
var Mongolian = require("mongolian");
var server = new Mongolian;
var db = server.db("database");
var shops = db.collection("collection");
db.server.close();
server.close();
答案 0 :(得分:0)
var Mongolian = require("mongolian");
var server = new Mongolian();
var database = server.db("database")
var db = {
collection: database.collection("collection"),
};
db.collection.find({},{"id":1}).limit(1).toArray(function(err, array){
console.log(array);
server.close();
});
在您提出请求之前,您无法关闭mongo,然后server.close()
将起作用。