<commit_before>var mongoose = require('mongoose'),
  async = require('async'),
  config = require('./config'),
  Schema = mongoose.Schema,
  mongoosastic = require('../lib/mongoosastic');

var CommentSchema = new Schema({
  user: String,
  post_date: {type:Date, es_type:'date'},
  message: {type:String},
  title: {type:String, es_boost:2.0}
});

CommentSchema.plugin(mongoosastic, {
  bulk: {
    size: 2,
    delay: 100
  }
});

var Comment = mongoose.model('Comment', CommentSchema);

describe.only('Count', function() {
  before(function(done) {
    mongoose.connect(config.mongoUrl, function() {
      Comment.remove(function() {
        config.deleteIndexIfExists(['comments'], function() {
          var comments = [
            new Comment({
              user: 'terry',
              title: 'Ilikecars'
            }),
            new Comment({
              user: 'fred',
              title: 'Ihatefish'
            })
          ];
          async.forEach(comments, function(item, cb) {
            item.save(cb);
          }, function() {
             setTimeout(done, 2000);
           });<commit_msg>Remove .only from tests<commit_after>var mongoose = require('mongoose'),
  async = require('async'),
  config = require('./config'),
  Schema = mongoose.Schema,
  mongoosastic = require('../lib/mongoosastic');

var CommentSchema = new Schema({
  user: String,
  post_date: {type:Date, es_type:'date'},
  message: {type:String},
  title: {type:String, es_boost:2.0}
});

CommentSchema.plugin(mongoosastic, {
  bulk: {
    size: 2,
    delay: 100
  }
});

var Comment = mongoose.model('Comment', CommentSchema);

describe('Count', function() {
  before(function(done) {
    mongoose.connect(config.mongoUrl, function() {
      Comment.remove(function() {
        config.deleteIndexIfExists(['comments'], function() {
          var comments = [
            new Comment({
              user: 'terry',
              title: 'Ilikecars'
            }),
            new Comment({
              user: 'fred',
              title: 'Ihatefish'
            })
          ];
          async.forEach(comments, function(item, cb) {
            item.save(cb);
          }, function() {
             setTimeout(done, 2000);
           });
{'fraction_non_alphanumeric': 0.15212527964205816, 'fraction_numerical': 0.008948545861297539, 'mean_word_length': 2.288235294117647, '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': '3349202', 'n_tokens_mistral': 675, 'n_tokens_neox': 668, 'n_words': 131}