const Db = require('mongodb').Db;
const Server = require('mongodb').Server;
const co = require('co');
const v1Db = new Db('v2-staging', new Server('localhost', 27017));
function* migrateBatch() {
const collectionV1Uploadfile = yield v1Db.collection('test');
return {};
}
co(migrateBatch()).then((data) => {
console.log('end of process');
});
我正在使用 nodejs- v6.9.4 mongo - v3.4.0 版本。并gettig以下错误。即使 mongo 文档说它返回 object 一个集合实例。 mongo 文档参考
ERROR (node:96130) UnhandledPromiseRejectionWarning: Unhandled Promise Rejection (rejection id: 1): TypeError: You may only yi // eld a function, promise, generator, array, or object, but the following object was passed: "[object Object ]"