<commit_before>'use strict';

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const FriendSchema = new Schema({
  userId: {
    type: Schema.Types.ObjectId,
    ref: 'User',
    required: true,
  },
  friendId: {
    type: Schema.Types.ObjectId,
    ref: 'User',
    required: true,
  },
  createdAt: {
    type: Date,
    required: true,
  },
  updatedAt: {
    type: Date,
    required: true,
  },
  statsAgainst: {
    wins: {
      type: Number,
      default: 0,
      required: true,
    },
    losses: {
      type: Number,
      default: 0,
      required: true,
    },
  },
});

FriendSchema.index({ userId: -1, friendId: -1 }, { unique: true });

module.exports = mongoose.model('Friend', FriendSchema);<commit_msg>Add ties to statsAgainst in Friend schema.<commit_after>'use strict';

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const FriendSchema = new Schema({
  userId: {
    type: Schema.Types.ObjectId,
    ref: 'User',
    required: true,
  },
  friendId: {
    type: Schema.Types.ObjectId,
    ref: 'User',
    required: true,
  },
  createdAt: {
    type: Date,
    required: true,
  },
  updatedAt: {
    type: Date,
    required: true,
  },
  statsAgainst: {
    wins: {
      type: Number,
      required: true,
      default: 0,
    },
    losses: {
      type: Number,
      required: true,
      default: 0,
    },
    ties: {
      type: Number,
      required: true,
      default: 0,
    }
  },
});

FriendSchema.index({ userId: -1, friendId: -1 }, { unique: true });

module.exports = mongoose.model('Friend', FriendSchema);
{'fraction_non_alphanumeric': 0.1472239550842171, 'fraction_numerical': 0.0056144728633811605, 'mean_word_length': 2.494553376906318, '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': '7088813', 'n_tokens_mistral': 543, 'n_tokens_neox': 550, 'n_words': 134}