连接后尝试运行您的集合名称功能。
mongoose.connection.on('open', function (ref) { console.log('Connected to mongo server.'); //trying to get collection names mongoose.connection.db.listCollections().toArray(function (err, names) { console.log(names); // [{ name: 'dbname.myCollection' }] module.exports.Collection = names; });})
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)