integration/helper.js
function insertDocsToDb(dburl, collectionName, docs, cb) {
  MongoClient.connect(dburl, function(err, db){
    if (err) {
      return cb(err);
    }
    var col = db.collection(collectionName);
    col.insertMany(docs, function(err, result){
      if (err) {
        return cb(err);
      }
      return cb(null, result);
    });
  });
}
function insertDocsToDb(dburl, collectionName, docs, cb) {
  MongoClient.connect(dburl, function(err, db){
    if (err) {
      return cb(err);
    }
    var col = db.collection(collectionName);
    col.insertMany(docs, function(err, result){
      if (err) {
        return cb(err);
      }
      return cb(null, result);
    });
  });
}
function insertDocsToDb ( dburl , collectionName , docs , cb ) { MongoClient . connect ( dburl , function ( err , db ) { if ( err ) { return cb ( err ) ; } var col = db . collection ( collectionName ) ; col . insertMany ( docs , function ( err , result ) { if ( err ) { return cb ( err ) ; } return cb ( null , result ) ; } ) ; } ) ; }
Helper function to insert some documents to the given db and collection
@param {String} dburl
@param {String} collectionName
@param {Array} docs
@param {Function} cb
Helper function to insert some documents to the given db and collection