<commit_before>/* eslint-disable no-console */ //This is because we are using console log for communications
const
  express = require('express'),
  request = require('request'),
  mongoose = require('mongoose'),
  fs = require('fs'),
  async = require('async'),
  _ = require('lodash'),
  mongoosePaginate = require('mongoose-paginate');

const
  Schema = mongoose.Schema,
  rest = express(),
  host = 'updates.jenkins-ci.org',
  url = `https://${host}/current/update-center.json`,
  backendPort = '3000',
  connection = mongoose.connection;

var Plugin;

connection.on('error', console.error);
connection.once('open', () => {
  const pluginSchema = new Schema({
    'buildDate': Date,
    'dependencies': [],
    'developers': [{
      'developerId': String,
      'email': String,
      'name': String
    }],
    'excerpt': String,
    'gav': String,
    'labels': [String],
    'name': String,
    '_updated': {type: Date, default: Date.now},
    '_created': {type: Date, default: Date.now},
    'previousTimestamp': Date,
    'previousVersion': String,
    'releaseTimestamp': Date,
    'requiredCore': String,
    'scm': String,
    'sha1': String,
    'title': String,
    'url': String,
    'version': String,
    'wiki': String
  });

  pluginSchema.plugin(mongoosePaginate);
  Plugin = mongoose.model('Plugin', pluginSchema);
});

function getOptions(req) {
  var page = req.query ? req.query.page : 1;
  var limit = req.query ? req.query.limit : 10;
  return options = {
    lean: true,
    select: 'title name, version requiredCore wiki developers sha1 excerpt labels',
    sort: { name: 1 },
    page: page || 1,
    limit: limit || 10
  };
}

function createResponseResults(docs){
  return {
    docs,
    limit: docs.length,
    total: docs.length,
    page: 1,
    pages: 1
  };
}<commit_msg>[issue/WEBSITE-89] Fix sort bug by removing limitation on fields we return<commit_after>/* eslint-disable no-console */ //This is because we are using console log for communications
const
  express = require('express'),
  request = require('request'),
  mongoose = require('mongoose'),
  fs = require('fs'),
  async = require('async'),
  _ = require('lodash'),
  mongoosePaginate = require('mongoose-paginate');

const
  Schema = mongoose.Schema,
  rest = express(),
  host = 'updates.jenkins-ci.org',
  url = `https://${host}/current/update-center.json`,
  backendPort = '3000',
  connection = mongoose.connection;

var Plugin;

connection.on('error', console.error);
connection.once('open', () => {
  const pluginSchema = new Schema({
    'buildDate': Date,
    'dependencies': [],
    'developers': [{
      'developerId': String,
      'email': String,
      'name': String
    }],
    'excerpt': String,
    'gav': String,
    'labels': [String],
    'name': String,
    '_updated': {type: Date, default: Date.now},
    '_created': {type: Date, default: Date.now},
    'previousTimestamp': Date,
    'previousVersion': String,
    'releaseTimestamp': Date,
    'requiredCore': String,
    'scm': String,
    'sha1': String,
    'title': String,
    'url': String,
    'version': String,
    'wiki': String
  });

  pluginSchema.plugin(mongoosePaginate);
  Plugin = mongoose.model('Plugin', pluginSchema);
});

function getOptions(req) {
  var page = req.query ? req.query.page : 1;
  var limit = req.query ? req.query.limit : 10;
  return options = {
    lean: true,
    sort: { name: 1 },
    page: page || 1,
    limit: limit || 10
  };
}

function createResponseResults(docs){
  return {
    docs,
    limit: docs.length,
    total: docs.length,
    page: 1,
    pages: 1
  };
}
{'fraction_non_alphanumeric': 0.1627260083449235, 'fraction_numerical': 0.008623087621696801, 'mean_word_length': 3.358787878787879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4676982', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1160, 'n_words': 296}