如题,望回复。 或是想再问, db=require(‘mongodb’).Db connection=require(‘mongodb’).Connection server=require(‘mongodb’).Server mongo=require(mongodb’)
以上的对象哪个可以遍历数据库呢?
2 回复
/**
* Get the list of all collection names for the specified db
*
* Options
* - **namesOnly** {String, default:false}, Return only the full collection namespace.
*
* @param {String} [collectionName] the collection name we wish to filter by.
* @param {Object} [options] additional options during update.
* @param {Function} callback returns option results.
* @return {null}
* @api public
*/
db.collectionNames();
/**
* Fetch all collections for the current db.
*
* @param {Function} callback returns the results.
* @return {null}
* @api public
*/
db.collections();
server.allRawConnections();
第三个没试过,但都能在源码里找到