<commit_before># Comments

**Comments** is an abstraction layer for MongoDB that allows for easily
providing some commenting functionality.

## Usage

```javascript
new Comments(options)
```

Creates a new Comments object. This means, a connection to MongoDB is set up.

*   `options` is an object that defines some DB connection parameters.

    The default options are as follows:

    ```javascript
    {
      host: 'localhost',      // - hostname of the server where mongodb is
                              //   running
      port: 27017,            // - port that is used by mongodb
      name: 'website',        // - name of the mongodb database
      collection: 'comments'  // - name of the collection that contains the
                              //   comments
    }
    ```

    For more information on how to define `opt.index` look at
    [the MongoDB documentation][mongodb-doc-indexes].

---

```javascript
comments.saveComment(comment, saved)<commit_msg>Fix index option<commit_after># Comments

**Comments** is an abstraction layer for MongoDB that allows for easily
providing some commenting functionality.

## Usage

```javascript
new Comments(options)
```

Creates a new Comments object. This means, a connection to MongoDB is set up.

*   `options` is an object that defines some DB connection parameters.

    The default options are as follows:

    ```javascript
    {
      host: 'localhost',      // - hostname of the server where mongodb is
                              //   running
      port: 27017,            // - port that is used by mongodb
      name: 'website',        // - name of the mongodb database
      collection: 'comments'  // - name of the collection that contains the
                              //   comments
    }
    ```

---

```javascript
comments.saveComment(comment, saved)
{'fraction_non_alphanumeric': 0.08624454148471616, 'fraction_numerical': 0.0054585152838427945, 'mean_word_length': 2.187826086956522, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4382712', 'n_tokens_mistral': 492, 'n_tokens_neox': 447, 'n_words': 194}