const mongoose = require("mongoose");

var articleInfosSchema = new mongoose.Schema({
  article_id: Number,
  article_title: {
    type: String,
    required: true 
  },
  global_rating : {
    type: Number,
    default: 0
  },
  article_clicks : {
    type: Number,
    default: 0
  },
  search_query : {
    type: String,
    required: true
  },
});

articleInfosSchema.index({
  article_title: 1,
  search_query: 1,
}, {
  unique: true,
});

module.exports = mongoose.model("articleInfos", articleInfosSchema);