2017-02-15 3 views

ответ

5

Действительно, mongoose.connection.db.collectionNames была отброшена в пользу mongoose.connection.db.listCollections

const mongoose = require('mongoose'); 

const connection = mongoose.connect('mongodb://localhost:27017'); 

connection.on('open', function() { 
    connection.db.listCollections().toArray(function (err, names) { 
     if (err) { 
     console.log(err); 
     } else { 
     console.log(names); 
     } 

     mongoose.connection.close(); 
    }); 
}); 
.

 Смежные вопросы

  • Нет связанных вопросов^_^