<commit_before>var async = require('async');

module.exports = function(grunt) {
  grunt.registerTask("mongoimport", "Grunt task for importing data into mongodb", function() {

  var done = this.async();
  var options = this.options();
  
  async.eachSeries(options.collections, function(collection, callback){
    var args = [];

    if (options.db) args.push('--db=' + options.db);
    if (options.host) args.push('--host=' + options.host);
    if (options.port) args.push('--port=' + options.port);
    if (options.username) args.push('--db=' + options.username);
    if (options.password) args.push('--db=' + options.password);
    if (options.stopOnError) args.push('--stopOnError');

    if (collection.name) args.push('--collection=' + collection.name);
    if (collection.type) args.push('--type=' + collection.type);
    if (collection.file) args.push('--file=' + collection.file);
    if (collection.fields) args.push('--fields=' + collection.fields);
    if (collection.upsertFields) args.push('--upsertFields=' + collection.upsertFields);
    if (collection.jsonArray) args.push('--jsonArray');
    if (collection.upsert) args.push('--upsert');
    if (collection.drop) args.push('--drop');

    var child = grunt.util.spawn({
      cmd: 'mongoimport',
          args: args,
          opts:
          { stdio:
              [ process.stdin
              , process.stout
              , process.stderr
              ]
          }
        },
        function (error, result) {
          if (error) {
            grunt.log.error(result.stderr);
            callback();
          }
          grunt.log.writeln(result.stdout);
          callback();
        });<commit_msg>fixing username and password flags<commit_after>var async = require('async');

module.exports = function(grunt) {
  grunt.registerTask("mongoimport", "Grunt task for importing data into mongodb", function() {

  var done = this.async();
  var options = this.options();
  
  async.eachSeries(options.collections, function(collection, callback){
    var args = [];

    if (options.db) args.push('--db=' + options.db);
    if (options.host) args.push('--host=' + options.host);
    if (options.port) args.push('--port=' + options.port);
    if (options.username) args.push('--username=' + options.username);
    if (options.password) args.push('--password=' + options.password);
    if (options.stopOnError) args.push('--stopOnError');

    if (collection.name) args.push('--collection=' + collection.name);
    if (collection.type) args.push('--type=' + collection.type);
    if (collection.file) args.push('--file=' + collection.file);
    if (collection.fields) args.push('--fields=' + collection.fields);
    if (collection.upsertFields) args.push('--upsertFields=' + collection.upsertFields);
    if (collection.jsonArray) args.push('--jsonArray');
    if (collection.upsert) args.push('--upsert');
    if (collection.drop) args.push('--drop');

    var child = grunt.util.spawn({
      cmd: 'mongoimport',
          args: args,
          opts:
          { stdio:
              [ process.stdin
              , process.stout
              , process.stderr
              ]
          }
        },
        function (error, result) {
          if (error) {
            grunt.log.error(result.stderr);
            callback();
          }
          grunt.log.writeln(result.stdout);
          callback();
        });
{'fraction_non_alphanumeric': 0.16750221173695076, 'fraction_numerical': 0.0, 'mean_word_length': 2.5150259067357514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '879285', 'n_tokens_mistral': 1008, 'n_tokens_neox': 995, 'n_words': 200}