0
どのように私はmongooseで名前コレクションのリストを取得できますか?
古い答え -
mongoose.connection.db.collectionNamesはコレクションはどのようにマングースに表示されますか?
どのように私はmongooseで名前コレクションのリストを取得できますか?
古い答え -
mongoose.connection.db.collectionNamesはコレクションはどのようにマングースに表示されますか?
実際、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();
});
});
。