'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);

@@ -461,40 +461,40 @@
     
-default: 0,%0A      required: true
+required: true,%0A      default: 0
 ,%0A  
@@ -534,34 +534,95 @@
 mber,%0A      
-default: 0
+required: true,%0A      default: 0,%0A    %7D,%0A    ties: %7B%0A      type: Number
 ,%0A      requ
@@ -637,18 +637,35 @@
 ue,%0A    
+  default: 0,%0A    
 %7D
-,
 %0A  %7D,%0A%7D)

Add ties to statsAgainst in Friend schema.